Hi there,

linestring linestring1{ {2000.0, 0.0}, {4000.0, 0.0} };

linestring linestring2{ {1000.0, 0.0}, {1999.999999999, 0.0} };

std::vector<point2d> result;

boost::geometry::intersection(linestring1, linestring2, result);

I know that this may has been raised again; however, I can't find any clear answer/solution so far. Does anyone know what is the best way to overwrite the tolerance for linestring-to-linestring and segment-to-segment intersection(s) in boost geometry?

For example, what is the best way to get such an intersection

using point2d = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;

using linestring = boost::geometry::model::linestring<point2d>;linestring linestring1{ {2000.0, 0.0}, {4000.0, 0.0} };

linestring linestring2{ {1000.0, 0.0}, {1999.999999999, 0.0} };

std::vector<point2d> result;

boost::geometry::intersection(linestring1, linestring2, result);

I understand that by default boost uses the std::numeric_limits<double>::epsilon for point of type double. I can also see that under utils/math there is an equal::apply function for such comparisons. When I specialise this function for my point types and I add the preprocessor macro "BOOST_GEOMETRY_NO_ROBUSTNESS", I get the intersection. Is there any better way to accomplish this? Can I do something similar with a rescaling policy? I tried to find something relevant in the docs but I have had no luck (I would not like to specialise anything under boost::geometry::detail).

Furthermore, is there any strategy and/or way to calculate the perpendicular distance between two linestrings? Or I have to work it out by myself (it should not be so difficult I just wonder whether there is strategy already inside boost geometry)?

Many thanks in advance,

Giorgio