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

Method BuildIntersectList

TheForceEngine/TFE_Polygon/clipper.cpp:2856–2902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2854//------------------------------------------------------------------------------
2855
2856void Clipper::BuildIntersectList(const cInt topY)
2857{
2858 if ( !m_ActiveEdges ) return;
2859
2860 //prepare for sorting ...
2861 TEdge* e = m_ActiveEdges;
2862 m_SortedEdges = e;
2863 while( e )
2864 {
2865 e->PrevInSEL = e->PrevInAEL;
2866 e->NextInSEL = e->NextInAEL;
2867 e->Curr.X = TopX( *e, topY );
2868 e = e->NextInAEL;
2869 }
2870
2871 //bubblesort ...
2872 bool isModified;
2873 do
2874 {
2875 isModified = false;
2876 e = m_SortedEdges;
2877 while( e->NextInSEL )
2878 {
2879 TEdge *eNext = e->NextInSEL;
2880 IntPoint Pt;
2881 if(e->Curr.X > eNext->Curr.X)
2882 {
2883 IntersectPoint(*e, *eNext, Pt);
2884 if (Pt.Y < topY) Pt = IntPoint(TopX(*e, topY), topY);
2885 IntersectNode * newNode = new IntersectNode;
2886 newNode->Edge1 = e;
2887 newNode->Edge2 = eNext;
2888 newNode->Pt = Pt;
2889 m_IntersectList.push_back(newNode);
2890
2891 SwapPositionsInSEL(e, eNext);
2892 isModified = true;
2893 }
2894 else
2895 e = eNext;
2896 }
2897 if( e->PrevInSEL ) e->PrevInSEL->NextInSEL = 0;
2898 else break;
2899 }
2900 while ( isModified );
2901 m_SortedEdges = 0; //important
2902}
2903//------------------------------------------------------------------------------
2904
2905

Callers

nothing calls this directly

Calls 4

TopXFunction · 0.85
IntersectPointFunction · 0.85
IntPointClass · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected