...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The Boost.Polygon point type (boost::polygon::point_data) is adapted to the Boost.Geometry Point 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.
#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 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