7 #include <boost/geometry.hpp>
8 #include <boost/geometry/algorithms/area.hpp>
9 #include <boost/geometry/algorithms/assign.hpp>
10 #include <boost/geometry/algorithms/detail/within/interface.hpp>
11 #include <boost/geometry/core/cs.hpp>
12 #include <boost/geometry/geometries/point_xy.hpp>
13 #include <boost/geometry/geometries/polygon.hpp>
14 #include <boost/geometry/geometries/register/point.hpp>
16 #include <VirtualRobot/MathTools.h>
18 BOOST_GEOMETRY_REGISTER_POINT_2D(Eigen::Vector2f,
float, cs::cartesian, x(), y())
22 namespace bg = boost::geometry;
27 using Point = bg::model::d2::point_xy<float>;
33 ConvexHull(
const std::vector<Eigen::Vector2f>& hull)
35 boost::geometry::assign_points(polygon, hull);
39 contains(
const Eigen::Vector2f& point)
const
41 return bg::within(
Point(point.x(), point.y()), polygon);
47 return static_cast<float>(bg::area(polygon));
51 bg::model::polygon<Point> polygon;