boost::geometry::concept::Point
point_concept.hpp
typename Geometry

Point concept.

# Formal definition:

The point concept is defined as following:

- there must be a specialization of traits::tag defining point_tag as type

- there must be a specialization of traits::coordinate_type defining the type of its coordinates

- there must be a specialization of traits::coordinate_system defining its coordinate system (cartesian, spherical, etc)

- there must be a specialization of traits::dimension defining its number of dimensions (2, 3, ...) (derive it conveniently from boost::mpl::int_<X> for X-D)

- there must be a specialization of traits::access, per dimension, with two functions:

  - get to get a coordinate value

  - set to set a coordinate value (this one is not checked for ConstPoint)

- for non-Cartesian coordinate systems, the coordinate system's units must either be boost::geometry::degree or boost::geometry::radian

# Example:

A legacy point, defining the necessary specializations to fulfil to the concept.

Suppose that the following point is defined:

    structlegacy_point1
    {
    doublex,y;
    };

It can then be adapted to the concept as following:

    //adaptlegacy_point1
    namespaceboost{namespacegeometry{namespacetraits
    {
    template<>structtag<legacy_point1>{typedefpoint_tagtype;};
    template<>structcoordinate_type<legacy_point1>{typedefdoubletype;};
    template<>structcoordinate_system<legacy_point1>{typedefcs::cartesiantype;};
    template<>structdimension<legacy_point1>:boost::mpl::int_<2>{};
    template<>structaccess<legacy_point1,0>
    {
    staticdoubleget(legacy_point1const&p){returnp.x;}
    staticvoidset(legacy_point1&p,doubleconst&value){p.x=value;}
    };
    template<>structaccess<legacy_point1,1>
    {
    staticdoubleget(legacy_point1const&p){returnp.y;}
    staticvoidset(legacy_point1&p,doubleconst&value){p.y=value;}
    };
    }}}//namespaceboost::geometry::traits

Note that it is done like above to show the system. Users will normally use the registration macro.

# Example:

A read-only legacy point, using a macro to fulfil to the ConstPoint concept. It cannot be modified by the library but can be used in all algorithms where points are not modified.

The point looks like the following:

    classlegacy_point2
    {
    public:
    doublex()const;
    doubley()const;
    };

It uses the macro as following:

    //adaptlegacy_point2
    BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(legacy_point2,double,boost::geometry::cs::cartesian,x(),y())
    //endadaptation