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

Function IsSegmentInCone

libs/geometry/robust_orientation.cpp:40–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40bool IsSegmentInCone(PointD const & v, PointD const & v1, PointD const & vPrev, PointD const & vNext)
41{
42 double const cpLR = OrientedS(vPrev, vNext, v);
43
44 if (cpLR == 0.0)
45 {
46 // Points vPrev, v, vNext placed on one line;
47 // use property that polygon has CCW orientation.
48 return OrientedS(vPrev, vNext, v1) > 0.0;
49 }
50
51 if (cpLR < 0.0)
52 {
53 // vertex is concave
54 return OrientedS(v, vPrev, v1) < 0.0 && OrientedS(v, vNext, v1) > 0.0;
55 }
56 // vertex is convex
57 return OrientedS(v, vPrev, v1) < 0.0 || OrientedS(v, vNext, v1) > 0.0;
58}
59} // namespace m2::robust

Callers 3

IsDiagonalVisibleFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 1

OrientedSFunction · 0.85

Tested by 1

UNIT_TESTFunction · 0.68