19 #include <boost/geometry.hpp>
22 using point_t = boost::geometry::model::d2::point_xy<double>;
23 using line_t = boost::geometry::model::linestring<point_t>;
41 double d = boost::geometry::distance(p, line);
43 return d < std::numeric_limits<double>::epsilon();
50 std::vector<point_t> box_points;
57 std::vector<point_t> line_points;
58 line_points.emplace_back(
m_x1,
m_y1);
59 line_points.emplace_back(
m_x2,
m_y2);
61 return boost::geometry::intersects(
line_t(box_points.begin(), box_points.end()),
62 line_t(line_points.begin(), line_points.end()));
Defines and implements namespace BaseUtils::algo with some algorithms.
Defines structs Bin1D, Bin1DCVector.
boost::geometry::model::linestring< point_t > line_t
boost::geometry::model::d2::point_xy< double > point_t
double m_upper
upper bound of the bin
double m_lower
lower bound of the bin
bool contains(double x, double y) const override
Returns true if point with given coordinates is inside or on border of the shape.
Basic class for all shapes in 2D.
bool contains(double x, double y) const override
Returns true if point with given coordinates is inside or on border of the shape.
Line(double x1, double y1, double x2, double y2)
bool contains(double x, double y) const override
Returns true if point with given coordinates is inside or on border of the shape.
bool almostEqual(double a, double b)
Returns true if two doubles agree within machine epsilon.