Given three points of a regular polygon( n > 3), find the minimum area of a regular polygon (all sides same) possible with the points given .
Input : 0.00 0.00 1.00 1.00 0.00 1.00 Output : 1.00 By taking point (1.00, 0.00) square is formed of side 1.0 so area = 1.00 .
One thing to note in question before we proceed is that the number of sides must be at least 4 (note n > 3 condition)..
Here, we have to find the minimum area possible for a regular polygon, so to calculate minimum possible area, we need calculate required value of n . As the side length is not given, so we first calculate circumradius of the triangle formed by the points. It is given by the formula
R = abc / 4A
where a, b, c are the sides of the triangle formed and A is the area of the traingle. Here, the area of triangle can be calculated by Heron’s Formula .
After calculating circumradius of the triangle, we calculate the area of the polygon by the formula
A = nX ( sin(360/n) xr2 /2 )
Here r represents the circumradius of n-gon ( regular polygon of n sides ) .
But, first we have to calculate value of n . To calculate n we first have to calculate all the angles of triangle by the cosine formula
cosA = ( b2+c2-a2 ) / 2bc
cosB = ( a2+c2-b2 ) / 2ac
cosC = ( a2+b2-c2 ) / 2ab
Then, n is given by
n = pi / GCD (A , B, C )
where A, B and C are the angles of the triangle . After calculating n we substitute this value to the formula for calculating area of polygon .
Below is the implementation of the given approach :
- Area of a polygon with given n ordered vertices
- Area of a n-sided regular polygon with given Radius
- Area of a n-sided regular polygon with given side length
- Minimum number of points to be removed to get remaining points on one side of axis
- Area of largest Circle inscribe in N-sided Regular polygon
- Minimum Cost Polygon Triangulation
- Minimum lines to cover all points
- Find minimum area of rectangle with given set of coordinates
- Minimum height of a triangle with given base and area
- Minimum tiles of sizes in powers of two to cover whole area
- Count of obtuse angles in a circle with 'k' equidistant points between 2 given points
- Ways to choose three points with distance between the most distant points <= L
- Number of Integral Points between Two Points
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Check if it is possible to create a polygon with given n sides
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : AnkitRai01