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

Method IsContributing

TheForceEngine/TFE_Polygon/clipper.cpp:1741–1838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1739//------------------------------------------------------------------------------
1740
1741bool Clipper::IsContributing(const TEdge& edge) const
1742{
1743 PolyFillType pft, pft2;
1744 if (edge.PolyTyp == ptSubject)
1745 {
1746 pft = m_SubjFillType;
1747 pft2 = m_ClipFillType;
1748 } else
1749 {
1750 pft = m_ClipFillType;
1751 pft2 = m_SubjFillType;
1752 }
1753
1754 switch(pft)
1755 {
1756 case pftEvenOdd:
1757 //return false if a subj line has been flagged as inside a subj polygon
1758 if (edge.WindDelta == 0 && edge.WindCnt != 1) return false;
1759 break;
1760 case pftNonZero:
1761 if (Abs(edge.WindCnt) != 1) return false;
1762 break;
1763 case pftPositive:
1764 if (edge.WindCnt != 1) return false;
1765 break;
1766 default: //pftNegative
1767 if (edge.WindCnt != -1) return false;
1768 }
1769
1770 switch(m_ClipType)
1771 {
1772 case ctIntersection:
1773 switch(pft2)
1774 {
1775 case pftEvenOdd:
1776 case pftNonZero:
1777 return (edge.WindCnt2 != 0);
1778 case pftPositive:
1779 return (edge.WindCnt2 > 0);
1780 default:
1781 return (edge.WindCnt2 < 0);
1782 }
1783 break;
1784 case ctUnion:
1785 switch(pft2)
1786 {
1787 case pftEvenOdd:
1788 case pftNonZero:
1789 return (edge.WindCnt2 == 0);
1790 case pftPositive:
1791 return (edge.WindCnt2 <= 0);
1792 default:
1793 return (edge.WindCnt2 >= 0);
1794 }
1795 break;
1796 case ctDifference:
1797 if (edge.PolyTyp == ptSubject)
1798 switch(pft2)

Callers

nothing calls this directly

Calls 1

AbsFunction · 0.85

Tested by

no test coverage detected