KB10355 - Calculate centroid point of an irregular shaped polygon.
The DK and Editor support two possibilities:
- Calculate the true centriod position, regardless whether or not it lies within or outside the polygon area. Use -
- Calculate the point within the polygon area closest to the true centroid position, to guarantee the calculated point is within the polygon boundary. Use -
It is possible to use a given point to reposition (move) an irregularly shaped polygon, such that the point becomes the centroid of the polygon in its new location. To do this, use:
shp.SetPosition( new_centroid_pos ) ;
Created: November 21, 2003, Modified: August 03, 2015