\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.3 - Principal Component Analysis
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

The function centroid() computes the (uniform) center of mass of a set of 2D or 3D bounded objects.

In 2D these objects include points, segments, triangles, iso rectangles, circles and disks. In 3D these objects include points, segments, triangles, iso cuboids, spheres, balls and tetrahedra.

The user can also optionally pass an explicit kernel, in case the default based on Kernel_traits is not sufficient. The default dimension tag is deduced automatically, although the user can pass a tag specifying the dimension of the objects to be considered for the centroid computation. For example, the default dimension of a tetrahedron is 3, but specifying a dimension 0 computes the centroid of the tetrahedron vertices (3D points), specifying a dimension 1 computes the centroid of the tetrahedron edges (3D segments) and specifying a dimension 2 computes the centroid of the tetrahedron facets (3D triangles).

See Also
CGAL::barycenter()
CGAL::centroid() (Linear Kernel)

Functions

Deduced CGAL::centroid (InputIterator first, InputIterator beyond, const Tag &t)
 computes the centroid of a non-empty set of 2D or 3D objects. More...
 
Deduced CGAL::centroid (InputIterator first, InputIterator beyond, const K &k, const Tag &t)
 computes the centroid of a non-empty set of 2D or 3D objects. More...