MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / FirstIsBottomPt

Function FirstIsBottomPt

TheForceEngine/TFE_Polygon/clipper.cpp:798–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796//------------------------------------------------------------------------------
797
798bool FirstIsBottomPt(const OutPt* btmPt1, const OutPt* btmPt2)
799{
800 OutPt *p = btmPt1->Prev;
801 while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Prev;
802 double dx1p = std::fabs(GetDx(btmPt1->Pt, p->Pt));
803 p = btmPt1->Next;
804 while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Next;
805 double dx1n = std::fabs(GetDx(btmPt1->Pt, p->Pt));
806
807 p = btmPt2->Prev;
808 while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Prev;
809 double dx2p = std::fabs(GetDx(btmPt2->Pt, p->Pt));
810 p = btmPt2->Next;
811 while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Next;
812 double dx2n = std::fabs(GetDx(btmPt2->Pt, p->Pt));
813
814 if (std::max(dx1p, dx1n) == std::max(dx2p, dx2n) &&
815 std::min(dx1p, dx1n) == std::min(dx2p, dx2n))
816 return Area(btmPt1) > 0; //if otherwise identical use orientation
817 else
818 return (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n);
819}
820//------------------------------------------------------------------------------
821
822OutPt* GetBottomPt(OutPt *pp)

Callers 2

GetBottomPtFunction · 0.85
GetLowermostRecFunction · 0.85

Calls 4

GetDxFunction · 0.85
maxFunction · 0.85
minFunction · 0.85
AreaFunction · 0.85

Tested by

no test coverage detected