19 #include <boost/geometry.hpp>
20 #include <boost/geometry/geometries/linestring.hpp>
21 #include <boost/geometry/geometries/point_xy.hpp>
24 using namespace boost::geometry;
25 typedef model::d2::point_xy<double>
point_t;
26 typedef model::box<point_t>
box_t;
27 typedef model::linestring<point_t>
line_t;
30 :
IShape2D(
"Line"), m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2)
41 double d = 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;
61 return intersects(
line_t(box_points.begin(), box_points.end()),
62 line_t(line_points.begin(), line_points.end()));
Defines and implements namespace algo with some algorithms.
Defines structs Bin1D, Bin1DCVector.
model::linestring< point_t > line_t
model::box< point_t > box_t
model::d2::point_xy< double > point_t
bool contains(double x, double y) const
Returns true if point with given coordinates is inside or on border of the shape.
Basic class for all shapes in 2D.
Line(double x1, double y1, double x2, double y2)
bool contains(double x, double y) const
Returns true if point with given coordinates is inside or on border of the shape.
bool contains(double x, double y) const
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.
double m_upper
upper bound of the bin
double m_lower
lower bound of the bin