Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Boost.Polygon's polygon_with_holes_data

Boost.Polygon's polygon type supporting holes (boost::polygon::polygon_with_holes_data) is adapted to the Boost.Geometry Polygon Concept.


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

Polygon Concept


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

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


Shows how to use Boost.Polygon points 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;


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