Calculate the area of an irregular cyclic convex polygon

579 Views Asked by At

I want to write a program in C++ to calculate the area of irregular cyclic convex polygons. However, the inputs are in the form corner point angles. I am just not sure what the inputs mean and what formula to use. Here is the question; I just need an explanation of what the input means and what equation to use to calculate the area.

The question paper

1

There are 1 best solutions below

0
On

Let the radius be $r$.

Inputs are $a_i$; where $i = 1, …, n$. Of course, all input should observe the rule $0^0 \le a_i \le 360^0$.

A simple sorting and re-ordering is necessary to ensure that $a_i \lt a_j$ if $i \lt j$.

Thus, after the above, we can assume that all these con-cyclic points are in anti-clockwise order.

For an $a_i$, there is a corresponding con-cyclic point whose co-ordinates are $(r \cdot \cos (a_i), r \cdot \sin (a_i))$.

The required area can then be obtained using the shoelace theorem. Example link = http://www.avmathteam.org/lessons/shoelacetheorem