5 #include <boost/geometry.hpp>
6 #include <boost/geometry/algorithms/assign.hpp>
7 #include <boost/geometry/algorithms/detail/within/interface.hpp>
8 #include <boost/geometry/algorithms/distance.hpp>
9 #include <boost/geometry/algorithms/make.hpp>
10 #include <boost/geometry/geometries/point_xy.hpp>
11 #include <boost/geometry/geometries/polygon.hpp>
12 #include <boost/geometry/geometries/register/point.hpp>
13 #include <boost/geometry/strategies/strategies.hpp>
15 #include <VirtualRobot/MathTools.h>
17 BOOST_GEOMETRY_REGISTER_POINT_2D(Eigen::Vector2f,
float, cs::cartesian, x(), y())
21 namespace bg = boost::geometry;
26 using Point = bg::model::d2::point_xy<float>;
32 ConvexHull(
const std::vector<Eigen::Vector2f>& hull)
34 boost::geometry::assign_points(polygon, hull);
37 bool contains(
const Eigen::Vector2f& point)
const
39 return bg::within(
Point(point.x(), point.y()), polygon);
44 return static_cast<float>(bg::area(polygon));
48 bg::model::polygon<Point> polygon;