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

Method ExecuteInternal

TheForceEngine/TFE_Polygon/clipper.cpp:1560–1621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1558//------------------------------------------------------------------------------
1559
1560bool Clipper::ExecuteInternal()
1561{
1562 bool succeeded = true;
1563 try {
1564 Reset();
1565 m_Maxima = MaximaList();
1566 m_SortedEdges = 0;
1567
1568 succeeded = true;
1569 cInt botY, topY;
1570 if (!PopScanbeam(botY)) return false;
1571 InsertLocalMinimaIntoAEL(botY);
1572 while (PopScanbeam(topY) || LocalMinimaPending())
1573 {
1574 ProcessHorizontals();
1575 ClearGhostJoins();
1576 if (!ProcessIntersections(topY))
1577 {
1578 succeeded = false;
1579 break;
1580 }
1581 ProcessEdgesAtTopOfScanbeam(topY);
1582 botY = topY;
1583 InsertLocalMinimaIntoAEL(botY);
1584 }
1585 }
1586 catch(...)
1587 {
1588 succeeded = false;
1589 }
1590
1591 if (succeeded)
1592 {
1593 //fix orientations ...
1594 for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
1595 {
1596 OutRec *outRec = m_PolyOuts[i];
1597 if (!outRec->Pts || outRec->IsOpen) continue;
1598 if ((outRec->IsHole ^ m_ReverseOutput) == (Area(*outRec) > 0))
1599 ReversePolyPtLinks(outRec->Pts);
1600 }
1601
1602 if (!m_Joins.empty()) JoinCommonEdges();
1603
1604 //unfortunately FixupOutPolygon() must be done after JoinCommonEdges()
1605 for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
1606 {
1607 OutRec *outRec = m_PolyOuts[i];
1608 if (!outRec->Pts) continue;
1609 if (outRec->IsOpen)
1610 FixupOutPolyline(*outRec);
1611 else
1612 FixupOutPolygon(*outRec);
1613 }
1614
1615 if (m_StrictSimple) DoSimplePolygons();
1616 }
1617

Callers

nothing calls this directly

Calls 4

AreaFunction · 0.85
ReversePolyPtLinksFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected