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

Function IntersectEdge

libs/geometry/clipping.cpp:50–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49template <class AddPointFnT>
50bool IntersectEdge(m2::RectD const & rect, CornersT const & corners, m2::PointD const & pp1, m2::PointD const & pp2,
51 m2::PointD const & pp3, AddPointFnT const & addPolygonPoint, int prevClipCode, int nextClipCode,
52 int & firstClipCode, int & lastClipCode)
53{
54 m2::PointD p1 = pp1;
55 m2::PointD p2 = pp2;
56
57 if (m2::Intersect(rect, p1, p2, firstClipCode, lastClipCode))
58 {
59 if (firstClipCode != 0 && prevClipCode != 0 && ((firstClipCode & prevClipCode) == 0))
60 InsertCorners(corners, pp1, pp2, pp3, addPolygonPoint, prevClipCode, firstClipCode);
61
62 addPolygonPoint(p1);
63 addPolygonPoint(p2);
64
65 if (lastClipCode != 0 && nextClipCode != 0 && ((lastClipCode & nextClipCode) == 0) &&
66 firstClipCode != lastClipCode && prevClipCode != nextClipCode)
67 InsertCorners(corners, pp1, pp2, pp3, addPolygonPoint, lastClipCode, nextClipCode);
68
69 return true;
70 }
71 else if (prevClipCode != 0 && nextClipCode != 0)
72 {
73 InsertCorners(corners, pp1, pp2, pp3, addPolygonPoint, prevClipCode, nextClipCode);
74 }
75 return false;
76}
77} // namespace
78
79void ClipTriangleByRect(m2::RectD const & rect, m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3,

Callers 1

ClipTriangleByRectFunction · 0.85

Calls 2

InsertCornersFunction · 0.85
IntersectFunction · 0.70

Tested by

no test coverage detected