Numerical experiments, Tips, Tricks and Gotchas
A polygon is a closed plane figure bounded by straight sides. Polygons include many common figures (triangles, rectangles, etc.). They also can be used for approximation of more complex shapes. Below is an irregular octagon:
Fig. 1. Polygon area.
Note that changing of contour path direction changes the integral sign. Because of this the calculated area $ A = 0 $ for the self-intersecting polygon in Fig. 2a (two equal triangles with the opposite path directions).
.Fig. 2a. Self-intersecting polygon; A = 0. | Fig. 2b. Irregular hexagon; A = 3. |
However for the polygon in Fig. 2b the calculated area $ A = 3 $ .
.
The formulae above were implemented in Python. The IPython HTML notebook experiments are available at the links below.
The IPython HTML notebook can be:
© Nikolai Shokhirev, 2012-2024
email: nikolai(dot)shokhirev(at)gmail(dot)com