GEOS  3.6.1
Public Member Functions | List of all members
geos::algorithm::CentroidArea Class Reference

Computes the centroid of an area geometry. More...

#include <geos/geosAlgorithm.h>

Public Member Functions

void add (const geom::Geometry *geom)
 
void add (const geom::CoordinateSequence *ring)
 
geom::CoordinategetCentroid () const
 
bool getCentroid (geom::Coordinate &ret) const
 Return false if a centroid couldn't be computed ( empty polygon )
 

Detailed Description

Computes the centroid of an area geometry.

Algorithm:

Based on the usual algorithm for calculating the centroid as a weighted sum of the centroids of a decomposition of the area into (possibly overlapping) triangles. The algorithm has been extended to handle holes and multi-polygons. See http://www.faqs.org/faqs/graphics/algorithms-faq/ for further details of the basic approach.

The code has also be extended to handle degenerate (zero-area) polygons. In this case, the centroid of the line segments in the polygon will be returned.

Deprecated:
use Centroid instead

Member Function Documentation

◆ add() [1/2]

void geos::algorithm::CentroidArea::add ( const geom::CoordinateSequence ring)

Adds the area defined by an array of coordinates. The array must be a ring; i.e. end with the same coordinate as it starts with.

Parameters
ringan array of Coordinates

◆ add() [2/2]

void geos::algorithm::CentroidArea::add ( const geom::Geometry geom)

Adds the area defined by a Geometry to the centroid total. If the geometry has no area it does not contribute to the centroid.

Parameters
geomthe geometry to add

The documentation for this class was generated from the following file: