MCPcopy Create free account
hub / github.com/comaps/comaps / SegmentsIntersect

Function SegmentsIntersect

libs/geometry/segment2d.cpp:43–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool SegmentsIntersect(PointD const & a, PointD const & b, PointD const & c, PointD const & d)
44{
45 using std::max, std::min;
46 return max(a.x, b.x) >= min(c.x, d.x) && min(a.x, b.x) <= max(c.x, d.x) && max(a.y, b.y) >= min(c.y, d.y) &&
47 min(a.y, b.y) <= max(c.y, d.y) && robust::OrientedS(a, b, c) * robust::OrientedS(a, b, d) <= 0.0 &&
48 robust::OrientedS(c, d, a) * robust::OrientedS(c, d, b) <= 0.0;
49}
50
51IntersectionResult Intersect(Segment2D const & seg1, Segment2D const & seg2, double eps)
52{

Callers 5

IsDiagonalVisibleFunction · 0.85
IntersectCellWithLineFunction · 0.85
IntersectFunction · 0.85
TestSegmentsIntersectFunction · 0.85
IsFencedOffMethod · 0.85

Calls 1

OrientedSFunction · 0.85

Tested by 1

TestSegmentsIntersectFunction · 0.68