Повышаю. Полигонный тип опорных отверстий Polygon (boost::polygon::polygon_with_holes_data) адаптирован к Boost. Концепция геометрии полигона.
Повышаю. Точки полигона (а также полигоны) могут использоваться Boost. Геометрия. Две библиотеки можно использовать вместе. Используя усилитель::polygon::polygon_with_holes_data<...>, алгоритмы от обоих Boost. Полигон и буст. Геометрию можно назвать
Polygon Concept
#include <boost/geometry/geometries/adapted/boost_polygon.hpp>
Стандартный заголовок<boost/geometry.hpp
>не включает этот заголовок.
Показывает, как использовать Boost.Polygon polygon_with_holes_data в Boost. Геометрия
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/boost_polygon.hpp>
int main()
{
typedef boost::polygon::polygon_with_holes_data<int> polygon;
typedef boost::polygon::polygon_traits<polygon>::point_type point;
typedef boost::polygon::polygon_with_holes_traits<polygon>::hole_type hole;
point pts[5] = {
boost::polygon::construct<point>(0, 0),
boost::polygon::construct<point>(0, 10),
boost::polygon::construct<point>(10, 10),
boost::polygon::construct<point>(10, 0),
boost::polygon::construct<point>(0, 0)
};
point hole_pts[5] = {
boost::polygon::construct<point>(1, 1),
boost::polygon::construct<point>(9, 1),
boost::polygon::construct<point>(9, 9),
boost::polygon::construct<point>(1, 9),
boost::polygon::construct<point>(1, 1)
};
hole hls[1];
boost::polygon::set_points(hls[0], hole_pts, hole_pts+5);
polygon poly;
boost::polygon::set_points(poly, pts, pts+5);
boost::polygon::set_holes(poly, hls, hls+1);
std::cout << "Area (using Boost.Geometry): "
<< boost::geometry::area(poly) << std::endl;
std::cout << "Area (using Boost.Polygon): "
<< boost::polygon::area(poly) << std::endl;
return 0;
}
Результат:
Area (using Boost.Geometry): 36
Area (using Boost.Polygon): 36