Page 1 of 1

The area of a triangle within a Cartesian coordinate system can be calculated by arranging the coordinates of its vertic

Posted: Mon May 09, 2022 9:48 am
by answerhappygod
The Area Of A Triangle Within A Cartesian Coordinate System Can Be Calculated By Arranging The Coordinates Of Its Vertic 1
The Area Of A Triangle Within A Cartesian Coordinate System Can Be Calculated By Arranging The Coordinates Of Its Vertic 1 (62.29 KiB) Viewed 29 times
The Area Of A Triangle Within A Cartesian Coordinate System Can Be Calculated By Arranging The Coordinates Of Its Vertic 2
The Area Of A Triangle Within A Cartesian Coordinate System Can Be Calculated By Arranging The Coordinates Of Its Vertic 2 (77.04 KiB) Viewed 29 times
The area of a triangle within a Cartesian coordinate system can be calculated by arranging the coordinates of its vertices ((x1, y.). (x,y) and (x, y)) in a 3 x 3 matrix as shown and by applying the determinant operation. The equation is A 1 2 1 1 1 || stands for the determinant operation. In Matlab the determinant operation is det(matrix). Alternatively, the area of such a triangle can be calculated directly by Aşlar , (9-) – 23 ()->) + za (in - 1)] To calculate the area of a convex polygon (and sometimes of a non-convex polygon) with an arbitrary number of vertices the polygon can be broken down into a series of triangles as shown below G.) A polygon of n-sides/vertices consists of n - 2 triangles. A polygon is convex when all angles of two consecutive side are smaller than 180°. The polygon shown is not convex, but still can be broken down into triangles. 1. Create a matlab script that calculates the area and the perimeter of an arbitrary convex (or, optinal, simple) polygon. This script should consist of the following parts a. The input data for the script is a 2 x n matrix. The first row consists of the x-coordinates, the second row of the corresponding y-coordinates of the vertices. The matrix looks like this inputPolygon = [ X1 X2 X3 X4 ... X y. Y y, Xy ... y.) Please note that the matrix can have any numbers of columns, i.e. the polygon can have an arbitrary number of vertices. For now, the inputPolygon matrix is created manually at the beginning of the script. b. The polygon should be plotted to visually check how it looks. There must be a function that takes 3 coordinates of a triangle as input arguments and that calculates the area of that triangle to pass it back as the output argument. C.
d. There must be a function that checks whether the polygon is convex or not. The input argument is the inputPolygon matrix (see a.). The output argument is an indicator whether the polygon is convex or not. e. There must be a function that calculates the perimeter of the polygon. This function does not depend on whether the polygon is convex or not. (It is mainly a series of application of the theorem of Pythagoras). Input data again is the inputPolygon matrix and the output argument should be the calculated value of the perimeter. f. If the polygon is convex, there must be a function that breaks down the polygon into triangles. The area of every triangle should be calculated by a function (see b.) and finally the area of the polygon should be calculated by adding these areas. The output argument of this function is the area of the polygon. g. (Optional) If the polygon is not convex, there should be a function that checks whether the polygon can be broken down into triangles anyway (this can also be added to the function created in d.). A simple, non-convex polygon can be broken down into triangle, when non of the triangles intersect. This can be checked by checking the position of a vertex in relation to the position of the previous vertex! To address the vertices, please do not use clockwise rotation but mathematical rotation direction. Provide an appropriate description of you functions. Use the header comment within the function to denote its usage, give a short explanation of what the function does and explain all input and output arguments.