

Not only does this make my calculated areas incorrect at times but I also need to figure out whether the figure is concave or convex, and the way I did that before was that I halfed the quad into two triangles and used the law of cosines.Ĭould anyone help me find a tangible solution to this issue? I can provide my code if needed. This leads to incorrect area on concave figures. In this instance, the area from the sum of the two triangles for the 2nd and 4th one will be fine, but the line between the 1st and 3rd vertices will not work out. The red line is the line between the first and third points, and the green is between the second and fourth.

However, whenever there is a concave one, there will be one diagonal that does not actually bisect or intersect the figure at all: When working with a convex quadrilateral (when there are no interior angles > 180 degrees), there is no issue. With the third way we are supposed to split up the quadrilateral into two triangles between the second and fourth vertices. With the second way we are supposed to split up the quadrilateral into two triangles between the first inputted and third inputted vertices. The second and third way do have issues though. The first way is straightforward and does not have any issues associated with it. In a C++ program, we are supposed to take in four data points of a quadrilateral (in order, so no jumping across the figure) and find the area in three different ways: I need some help on this, it is due by 11 PM tonight and I'm not quite sure where to go.
