| Home | Libraries | People | FAQ | More

#### strategy::centroid::bashein_detmer

Centroid calculation using algorith Bashein / Detmer.

###### Description

Calculates centroid using triangulation method published by Bashein / Detmer

Statements:

- MySQL/PostGIS: select AsText(Centroid(GeomFromText( 'POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6 ,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))')))
- Oracle: select sdo_geom.sdo_centroid(sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 1), sdo_ordinate_array( 2,1.3,2.4,1.7,2.8,1.8,3.4,1.2,3.7,1.6,3.4,2,4.1,3,5.3,2.6 ,5.4,1.2,4.9,0.8,2.9,0.7,2,1.3)) , mdsys.sdo_dim_array(mdsys.sdo_dim_element('x',0,10,.00000005) ,mdsys.sdo_dim_element('y',0,10,.00000005))) from dual
- SQL Server 2008: select geometry::STGeomFromText( 'POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6 ,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))',0) .STCentroid() .STAsText()

With holes:

- this: POINT(4.04663 1.6349)
- geolib: POINT(4.04675 1.65735)
- MySQL: POINT(3.6090580503834 1.607573932092)
- PostGIS: POINT(4.0466265060241 1.63489959839357)
- Oracle: 4.0466265060241 1.63489959839357
- SQL Server: POINT(4.0466264962959677 1.6348996057331333)

Statements:

- MySQL/PostGIS: select AsText(Centroid(GeomFromText( 'POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2 ,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3) ,(4 2,4.2 1.4,4.8 1.9,4.4 2.2,4 2))')));
- Oracle: select sdo_geom.sdo_centroid(sdo_geometry(2003, null, null , sdo_elem_info_array(1, 1003, 1, 25, 2003, 1) , sdo_ordinate_array(2,1.3,2.4,1.7,2.8,1.8,3.4,1.2,3.7,1.6,3.4, 2,4.1,3,5.3,2.6,5.4,1.2,4.9,0.8,2.9,0.7,2,1.3,4,2, 4.2,1.4, 4.8,1.9, 4.4,2.2, 4,2)) , mdsys.sdo_dim_array(mdsys.sdo_dim_element('x',0,10,.00000005) ,mdsys.sdo_dim_element('y',0,10,.00000005))) from dual

###### Synopsis

    template<typename Point, typename PointOfSegment, typename CalculationType>
    class strategy::centroid::bashein_detmer
    {
      // ...
    };

###### Template parameter(s)

Parameter | Default | Description
--- | --- | ---
typename Point |  | point type of centroid to calculate
typename PointOfSegment | Point | point type of segments, defaults to Point
typename CalculationType | void |

###### Member Function(s)

Function | Description | Parameters | Returns
--- | --- | --- | ---
    void apply(PointOfSegment const & p1, PointOfSegment const & p2, sums & state)
|  | PointOfSegment const &: p1: PointOfSegment const &: p2: sums &: state:
    bool result(sums const & state, Point & centroid)
|  | sums const &: state: Point &: centroid:

###### Header

`#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>`

###### See also

centroid (with strategy)