MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / BuildIntersectList

Method BuildIntersectList

static_libs/clipper/clipper.cpp:2836–2880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2834//------------------------------------------------------------------------------
2835
2836void Clipper::BuildIntersectList(const cInt topY)
2837{
2838 if (!m_ActiveEdges)
2839 return;
2840
2841 //prepare for sorting ...
2842 TEdge* e = m_ActiveEdges;
2843 m_SortedEdges = e;
2844 while (e) {
2845 e->PrevInSEL = e->PrevInAEL;
2846 e->NextInSEL = e->NextInAEL;
2847 e->Curr.X = TopX(*e, topY);
2848 e = e->NextInAEL;
2849 }
2850
2851 //bubblesort ...
2852 bool isModified;
2853 do {
2854 isModified = false;
2855 e = m_SortedEdges;
2856 while (e->NextInSEL) {
2857 TEdge* eNext = e->NextInSEL;
2858 IntPoint Pt;
2859 if (e->Curr.X > eNext->Curr.X) {
2860 IntersectPoint(*e, *eNext, Pt);
2861 if (Pt.Y < topY)
2862 Pt = IntPoint(TopX(*e, topY), topY);
2863 IntersectNode* newNode = new IntersectNode;
2864 newNode->Edge1 = e;
2865 newNode->Edge2 = eNext;
2866 newNode->Pt = Pt;
2867 m_IntersectList.push_back(newNode);
2868
2869 SwapPositionsInSEL(e, eNext);
2870 isModified = true;
2871 } else
2872 e = eNext;
2873 }
2874 if (e->PrevInSEL)
2875 e->PrevInSEL->NextInSEL = nullptr;
2876 else
2877 break;
2878 } while (isModified);
2879 m_SortedEdges = nullptr; //important
2880}
2881//------------------------------------------------------------------------------
2882
2883void Clipper::ProcessIntersectList()

Callers

nothing calls this directly

Calls 4

TopXFunction · 0.70
IntersectPointFunction · 0.70
IntPointClass · 0.70
push_backMethod · 0.45

Tested by

no test coverage detected