MCPcopy Create free account
hub / github.com/cinder/Cinder / ProcessEdgesAtTopOfScanbeam

Method ProcessEdgesAtTopOfScanbeam

blocks/Clipper/src/clipper.cpp:3009–3113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3007//------------------------------------------------------------------------------
3008
3009void Clipper::ProcessEdgesAtTopOfScanbeam(const cInt topY)
3010{
3011 TEdge* e = m_ActiveEdges;
3012 while( e )
3013 {
3014 //1. process maxima, treating them as if they're 'bent' horizontal edges,
3015 // but exclude maxima with horizontal edges. nb: e can't be a horizontal.
3016 bool IsMaximaEdge = IsMaxima(e, topY);
3017
3018 if(IsMaximaEdge)
3019 {
3020 TEdge* eMaxPair = GetMaximaPairEx(e);
3021 IsMaximaEdge = (!eMaxPair || !IsHorizontal(*eMaxPair));
3022 }
3023
3024 if(IsMaximaEdge)
3025 {
3026 if (m_StrictSimple) m_Maxima.push_back(e->Top.X);
3027 TEdge* ePrev = e->PrevInAEL;
3028 DoMaxima(e);
3029 if( !ePrev ) e = m_ActiveEdges;
3030 else e = ePrev->NextInAEL;
3031 }
3032 else
3033 {
3034 //2. promote horizontal edges, otherwise update Curr.X and Curr.Y ...
3035 if (IsIntermediate(e, topY) && IsHorizontal(*e->NextInLML))
3036 {
3037 UpdateEdgeIntoAEL(e);
3038 if (e->OutIdx >= 0)
3039 AddOutPt(e, e->Bot);
3040 AddEdgeToSEL(e);
3041 }
3042 else
3043 {
3044 e->Curr.X = TopX( *e, topY );
3045 e->Curr.Y = topY;
3046#ifdef use_xyz
3047 e->Curr.Z = topY == e->Top.Y ? e->Top.Z : (topY == e->Bot.Y ? e->Bot.Z : 0);
3048#endif
3049 }
3050
3051 //When StrictlySimple and 'e' is being touched by another edge, then
3052 //make sure both edges have a vertex here ...
3053 if (m_StrictSimple)
3054 {
3055 TEdge* ePrev = e->PrevInAEL;
3056 if ((e->OutIdx >= 0) && (e->WindDelta != 0) && ePrev && (ePrev->OutIdx >= 0) &&
3057 (ePrev->Curr.X == e->Curr.X) && (ePrev->WindDelta != 0))
3058 {
3059 IntPoint pt = e->Curr;
3060#ifdef use_xyz
3061 SetZ(pt, *ePrev, *e);
3062#endif
3063 OutPt* op = AddOutPt(ePrev, pt);
3064 OutPt* op2 = AddOutPt(e, pt);
3065 AddJoin(op, op2, pt); //StrictlySimple (type-3) join
3066 }

Callers

nothing calls this directly

Calls 9

IsMaximaFunction · 0.85
GetMaximaPairExFunction · 0.85
IsHorizontalFunction · 0.85
IsIntermediateFunction · 0.85
TopXFunction · 0.85
SlopesEqualFunction · 0.85
sortMethod · 0.80
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected