I need to know if a point lies on a segment in 2d.
I already solved that issue using Boost and intersects between a point and a segment.
Question
is it possible to use the Eigen library only?
Why:
I am currently in the middle of an algorithm that uses Eigen, and I don't want to copy my points again and again in a loop to a Boost geometry construct to check for this. This is what I currently do and it works. But it adds a dependency.
This is a contrived code:
using Line2 = Eigen::Hyperplane <double, 2>;
using Vec2 = Eigen::Vector2d;
Vec2 a( 0, 0 );
Vec2 b( 1, 1 );
Vec2 d(70, 100);
Line2 ab = Line2::Through( a, b );
auto res = ab.normal();
auto projection_point = ab.projection(d); <- that projection point is not on the segment ab
//.. here I test with Boost and loop again if necessary
if there is no alternative I will keep doing it the way I do, but I am sure someone knows better out there.
I don't want to write the function myself (otherwise, I prefer to keep using Boost). I just want to rely on Eigen.
Thanks