OnSegment
Returns true iff p lies on the line segment from s to e. Use (segDist(s,e,p)<=epsilon) instead when using Point<double>.
3 lines
Needs: "Point.h"
content/geometry/OnSegment.h — Victor Lecomte, chilli, source: https://vlecomte.github.io/cp-geo.pdf
template<class P> bool onSegment(P s, P e, P p) {
return p.cross(s, e) == 0 && (s - p).dot(e - p) <= 0;
}