centroid

# centroid: calculate centroid (center of gravity) of a geometry

boost::geometry::centroid_exception
boost::geometry::concept::CentroidStrategy
boost::geometry::strategy::centroid::services::default_strategy
typename Geometry
typename Point
typename Strategy
void void boost::geometry::centroid (Geometry const &geometry, Point &c, Strategy const &strategy) centroid Geometry const & geometry Point & c Strategy const & strategy

Calculates the centroid of a geometry using the specified strategy.

The free function centroid calculates the geometric center (or: center of mass) of a geometry. Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation. Geometry

Any type fulfilling a Geometry Concept

Point

Any type fulfilling a Point Concept

Strategy

Any type fulfilling a Centroid Strategy Concept

geometry

A model of the specified concept

c

A model of the specified Point Concept which is set to the \1

strategy

The strategy which will be used for centroid calculations

with strategy [include reference/algorithms/centroid.qbk] [include reference/algorithms/centroid_strategies.qbk] }
typename Geometry
typename Point
void void boost::geometry::centroid (Geometry const &geometry, Point &c) centroid Geometry const & geometry Point & c

Calculates the centroid of a geometry.

The free function centroid calculates the geometric center (or: center of mass) of a geometry. It uses the default strategy, based on the coordinate system of the geometry. Geometry

Any type fulfilling a Geometry Concept

Point

Any type fulfilling a Point Concept

geometry

A model of the specified concept

c

The calculated centroid will be assigned to this point reference

[include reference/algorithms/centroid.qbk] [heading Example] [centroid] [centroid_output]
typename Point
typename Geometry
Point Point boost::geometry::return_centroid (Geometry const &geometry) return_centroid Geometry const & geometry

Calculates the centroid of a geometry.

The free function centroid calculates the geometric center (or: center of mass) of a geometry. This version with the return_ prefix returns the centroid, and a template parameter must therefore be specified in the call.. Point

Any type fulfilling a Point Concept

Geometry

Any type fulfilling a Geometry Concept

geometry

A model of the specified concept

The calculated \1

[include reference/algorithms/centroid.qbk]
typename Point
typename Geometry
typename Strategy
Point Point boost::geometry::return_centroid (Geometry const &geometry, Strategy const &strategy) return_centroid Geometry const & geometry Strategy const & strategy

Calculates the centroid of a geometry using the specified strategy.

The free function centroid calculates the geometric center (or: center of mass) of a geometry. This version with the return_ prefix returns the centroid, and a template parameter must therefore be specified in the call.. Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation. Point

Any type fulfilling a Point Concept

Geometry

Any type fulfilling a Geometry Concept

Strategy

Any type fulfilling a centroid Strategy Concept

geometry

A model of the specified concept

strategy

The strategy which will be used for centroid calculations

The calculated \1

with strategy [include reference/algorithms/centroid.qbk] [include reference/algorithms/centroid_strategies.qbk]