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

Method InsertLocalMinimaIntoAEL

blocks/Clipper/src/clipper.cpp:1978–2077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1976//------------------------------------------------------------------------------
1977
1978void Clipper::InsertLocalMinimaIntoAEL(const cInt botY)
1979{
1980 const LocalMinimum *lm;
1981 while (PopLocalMinima(botY, lm))
1982 {
1983 TEdge* lb = lm->LeftBound;
1984 TEdge* rb = lm->RightBound;
1985
1986 OutPt *Op1 = 0;
1987 if (!lb)
1988 {
1989 //nb: don't insert LB into either AEL or SEL
1990 InsertEdgeIntoAEL(rb, 0);
1991 SetWindingCount(*rb);
1992 if (IsContributing(*rb))
1993 Op1 = AddOutPt(rb, rb->Bot);
1994 }
1995 else if (!rb)
1996 {
1997 InsertEdgeIntoAEL(lb, 0);
1998 SetWindingCount(*lb);
1999 if (IsContributing(*lb))
2000 Op1 = AddOutPt(lb, lb->Bot);
2001 InsertScanbeam(lb->Top.Y);
2002 }
2003 else
2004 {
2005 InsertEdgeIntoAEL(lb, 0);
2006 InsertEdgeIntoAEL(rb, lb);
2007 SetWindingCount( *lb );
2008 rb->WindCnt = lb->WindCnt;
2009 rb->WindCnt2 = lb->WindCnt2;
2010 if (IsContributing(*lb))
2011 Op1 = AddLocalMinPoly(lb, rb, lb->Bot);
2012 InsertScanbeam(lb->Top.Y);
2013 }
2014
2015 if (rb)
2016 {
2017 if (IsHorizontal(*rb))
2018 {
2019 AddEdgeToSEL(rb);
2020 if (rb->NextInLML)
2021 InsertScanbeam(rb->NextInLML->Top.Y);
2022 }
2023 else InsertScanbeam( rb->Top.Y );
2024 }
2025
2026 if (!lb || !rb) continue;
2027
2028 //if any output polygons share an edge, they'll need joining later ...
2029 if (Op1 && IsHorizontal(*rb) &&
2030 m_GhostJoins.size() > 0 && (rb->WindDelta != 0))
2031 {
2032 for (JoinList::size_type i = 0; i < m_GhostJoins.size(); ++i)
2033 {
2034 Join* jr = m_GhostJoins[i];
2035 //if the horizontal Rb and a 'ghost' horizontal overlap, then convert

Callers

nothing calls this directly

Calls 4

IsHorizontalFunction · 0.85
HorzSegmentsOverlapFunction · 0.85
SlopesEqualFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected