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

Function InsertCorners

libs/geometry/clipping.cpp:29–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <class AddPointFnT>
29void InsertCorners(CornersT const & corners, m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3,
30 AddPointFnT const & addPolygonPoint, int code1, int code2)
31{
32 int cornerInd = GetRectSideIndex(code1);
33 int endCornerInd = GetRectSideIndex(code2);
34
35 if (!IsPointInsideTriangle(corners[cornerInd], p1, p2, p3))
36 {
37 if (!IsPointInsideTriangle(corners[endCornerInd], p1, p2, p3))
38 return;
39 std::swap(cornerInd, endCornerInd);
40 }
41
42 while (cornerInd != endCornerInd)
43 {
44 addPolygonPoint(corners[cornerInd]);
45 cornerInd = (cornerInd + 1) % 4;
46 }
47}
48
49template <class AddPointFnT>
50bool IntersectEdge(m2::RectD const & rect, CornersT const & corners, m2::PointD const & pp1, m2::PointD const & pp2,

Callers 2

IntersectEdgeFunction · 0.85
ClipTriangleByRectFunction · 0.85

Calls 3

GetRectSideIndexFunction · 0.85
IsPointInsideTriangleFunction · 0.85
swapFunction · 0.70

Tested by

no test coverage detected