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

Method IntersectEdges

TheForceEngine/TFE_Polygon/clipper.cpp:2106–2298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2104#endif
2105
2106void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &Pt)
2107{
2108 bool e1Contributing = ( e1->OutIdx >= 0 );
2109 bool e2Contributing = ( e2->OutIdx >= 0 );
2110
2111#ifdef use_xyz
2112 SetZ(Pt, *e1, *e2);
2113#endif
2114
2115#ifdef use_lines
2116 //if either edge is on an OPEN path ...
2117 if (e1->WindDelta == 0 || e2->WindDelta == 0)
2118 {
2119 //ignore subject-subject open path intersections UNLESS they
2120 //are both open paths, AND they are both 'contributing maximas' ...
2121 if (e1->WindDelta == 0 && e2->WindDelta == 0) return;
2122
2123 //if intersecting a subj line with a subj poly ...
2124 else if (e1->PolyTyp == e2->PolyTyp &&
2125 e1->WindDelta != e2->WindDelta && m_ClipType == ctUnion)
2126 {
2127 if (e1->WindDelta == 0)
2128 {
2129 if (e2Contributing)
2130 {
2131 AddOutPt(e1, Pt);
2132 if (e1Contributing) e1->OutIdx = Unassigned;
2133 }
2134 }
2135 else
2136 {
2137 if (e1Contributing)
2138 {
2139 AddOutPt(e2, Pt);
2140 if (e2Contributing) e2->OutIdx = Unassigned;
2141 }
2142 }
2143 }
2144 else if (e1->PolyTyp != e2->PolyTyp)
2145 {
2146 //toggle subj open path OutIdx on/off when Abs(clip.WndCnt) == 1 ...
2147 if ((e1->WindDelta == 0) && abs(e2->WindCnt) == 1 &&
2148 (m_ClipType != ctUnion || e2->WindCnt2 == 0))
2149 {
2150 AddOutPt(e1, Pt);
2151 if (e1Contributing) e1->OutIdx = Unassigned;
2152 }
2153 else if ((e2->WindDelta == 0) && (abs(e1->WindCnt) == 1) &&
2154 (m_ClipType != ctUnion || e1->WindCnt2 == 0))
2155 {
2156 AddOutPt(e2, Pt);
2157 if (e2Contributing) e2->OutIdx = Unassigned;
2158 }
2159 }
2160 return;
2161 }
2162#endif
2163

Callers

nothing calls this directly

Calls 4

absFunction · 0.85
AbsFunction · 0.85
SwapSidesFunction · 0.85
SwapPolyIndexesFunction · 0.85

Tested by

no test coverage detected