| Home | Libraries | People | FAQ | More

##### Boost.Polygon's point_data

The Boost.Polygon point type (boost::polygon::point_data) is adapted to the Boost.Geometry Point Concept.

###### Description

Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry. The two libraries can therefore be used together. Using a boost::polygon::point_data<...>, algorithms from both Boost.Polygon and Boost.Geometry can be called.

###### Model of

Point Concept

###### Header

`#include <boost/geometry/geometries/adapted/boost_polygon.hpp>`

The standard header `boost/geometry.hpp` does not include this header.

###### Example

Shows how to use Boost.Polygon point_data within Boost.Geometry

    #include <iostream>
    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/adapted/boost_polygon.hpp>

    int main()
    {
        boost::polygon::point_data<int> a(1, 2), b(3, 4);
        std::cout << "Distance (using Boost.Geometry): "
            << boost::geometry::distance(a, b) << std::endl;
        std::cout << "Distance (using Boost.Polygon): "
            << boost::polygon::euclidean_distance(a, b) << std::endl;

        return 0;
    }

Output:

    Distance (using Boost.Geometry): 2.82843
    Distance (using Boost.Polygon): 2.82843