Boost.Geometry    Boost C++ Libraries
Classes | Functions
centroid: calculate centroid (center of gravity) of a geometry

Classes

class  boost::geometry::centroid_exception
 Centroid Exception. More...
 
class  boost::geometry::concepts::CentroidStrategy< Strategy >
 Checks strategy for centroid. More...
 
struct  boost::geometry::strategy::centroid::services::default_strategy< CsTag, GeometryTag, Dimension, Point, Geometry >
 Traits class binding a centroid calculation strategy to a coordinate system. More...
 

Functions

template<typename Geometry , typename Point , typename Strategy >
void boost::geometry::centroid (Geometry const &geometry, Point &c, Strategy const &strategy)
 Calculates the centroid of a geometry using the specified strategy. More...
 
template<typename Geometry , typename Point >
void boost::geometry::centroid (Geometry const &geometry, Point &c)
 Calculates the centroid of a geometry. More...
 
template<typename Point , typename Geometry >
Point boost::geometry::return_centroid (Geometry const &geometry)
 Calculates the centroid of a geometry. More...
 
template<typename Point , typename Geometry , typename Strategy >
Point boost::geometry::return_centroid (Geometry const &geometry, Strategy const &strategy)
 Calculates the centroid of a geometry using the specified strategy. More...
 

Detailed Description

Function Documentation

template<typename Geometry , typename Point , typename Strategy >
void boost::geometry::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.

Template Parameters
GeometryAny type fulfilling a Geometry Concept
PointAny type fulfilling a Point Concept
StrategyAny type fulfilling a Centroid Strategy Concept
Parameters
geometryA model of the specified concept
cA model of the specified Point Concept which is set to the centroid
strategyThe strategy which will be used for centroid calculations
}

Examples:
03_polygon_example.cpp, 06_b_transformation_example.cpp, c04_a_custom_triangle_example.cpp, and c04_b_custom_triangle_example.cpp.
template<typename Geometry , typename Point >
void boost::geometry::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.

Template Parameters
GeometryAny type fulfilling a Geometry Concept
PointAny type fulfilling a Point Concept
Parameters
geometryA model of the specified concept
cThe calculated centroid will be assigned to this point reference
template<typename Point , typename Geometry >
Point boost::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..

Template Parameters
PointAny type fulfilling a Point Concept
GeometryAny type fulfilling a Geometry Concept
Parameters
geometryA model of the specified concept
Returns
The calculated centroid
template<typename Point , typename Geometry , typename Strategy >
Point boost::geometry::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.

Template Parameters
PointAny type fulfilling a Point Concept
GeometryAny type fulfilling a Geometry Concept
StrategyAny type fulfilling a centroid Strategy Concept
Parameters
geometryA model of the specified concept
strategyThe strategy which will be used for centroid calculations
Returns
The calculated centroid

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands
Copyright © 2008-2011 Bruno Lalande, Paris, France
Copyright © 2009-2010 Mateusz Loskot, London, UK
Documentation is generated by Doxygen