A polygon P with n sides can be represented by a tuple P = ( P 0 , P 1 , … , P n − 1 ) that contains the vertices P i = ( x i , y i ) ∈ R 2 of the polygon as elements. Successive points in the tuple are connected by an edge. In addition, last point P n − 1 is connected to the first point P 0 .
How large is the area of the polygon shown on the right?
This simple polygon is represented by the following tuple of vertices:
1 2 3 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
How do you derive the formula for the area of a polygon with given vertices?
Log in to reply
It is easier to illustrate this formula in a single triangle. Draw a single triangle with the points A = ( a x , a y ) , B = ( b x , b y ) and C = ( c x , c y ) . The triangular area can be represented as the enclosed area of two functions f ( x ) and g ( x ) . Let's assume that the function g ( x ) is the line A B and the function f ( x ) is composed of the lines A C and C B . The triangle area then results as the integral I = ∫ ( f ( x ) − g ( x ) ) d x . The integrals can be easily calculated since only trapezoidal shapes need to be considered I = ∫ f ( x ) d x − ∫ g ( x ) d x = 2 1 ( a y + c y ) ( c x − a x ) + 2 1 ( c y + b y ) ( b x − c x ) − 2 1 ( a y + b y ) ( b x − a x ) = 2 1 ( ( c x a y − c y a x ) + ( b x c y − b y c x ) + ( a x b y − a y b x ) ) That's already the formula for the polygon for the case n = 3. For the general case, we just have to show two things:
If you can understand German, this video might be helpful. Just jump to the minute 44 in the video.
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: Irregular Polygons
The area of a polygon with vertices ( x i , y i ) , i = 1 , … , n − 1 is given by the formula A = i = 0 ∑ n − 1 A i = 2 1 i = 0 ∑ n − 1 ( x i − 1 ⋅ y i − x i ⋅ y j − 1 ) where ( x − 1 , y − 1 ) = ( x n − 1 , y n − 1 ) . Each summand of this equation corresponds to the area of a single triangle, which is formed by the points P i − 1 , P i and the origin O = ( 0 , 0 ) . This triangular area is calculated with the determinant A i = 2 1 ∣ ∣ ∣ ∣ x i − 1 x i y i − 1 y i ∣ ∣ ∣ ∣ = 2 1 ( x i − 1 ⋅ y i − x i ⋅ y j − 1 ) Note, that some of summands A i are negative and corrospond to an area outside of the polygon, that has to be subtracted.
The following python program calculates the area for the given polygon: