MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / ProcessHorzJoins

Method ProcessHorzJoins

CPP/Clipper2Lib/src/clipper.engine.cpp:2279–2345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2277 }
2278
2279 void ClipperBase::ProcessHorzJoins()
2280 {
2281 for (const HorzJoin& j : horz_join_list_)
2282 {
2283 OutRec* or1 = GetRealOutRec(j.op1->outrec);
2284 OutRec* or2 = GetRealOutRec(j.op2->outrec);
2285
2286 OutPt* op1b = j.op1->next;
2287 OutPt* op2b = j.op2->prev;
2288 j.op1->next = j.op2;
2289 j.op2->prev = j.op1;
2290 op1b->prev = op2b;
2291 op2b->next = op1b;
2292
2293 if (or1 == or2) // 'join' is really a split
2294 {
2295 or2 = NewOutRec();
2296 or2->pts = op1b;
2297 FixOutRecPts(or2);
2298
2299 //if or1->pts has moved to or2 then update or1->pts!!
2300 if (or1->pts->outrec == or2)
2301 {
2302 or1->pts = j.op1;
2303 or1->pts->outrec = or1;
2304 }
2305
2306 if (using_polytree_) //#498, #520, #584, D#576, #618
2307 {
2308 if (Path2ContainsPath1(or1->pts, or2->pts))
2309 {
2310 //swap or1's & or2's pts
2311 OutPt* tmp = or1->pts;
2312 or1->pts = or2->pts;
2313 or2->pts = tmp;
2314 FixOutRecPts(or1);
2315 FixOutRecPts(or2);
2316 //or2 is now inside or1
2317 or2->owner = or1;
2318 }
2319 else if (Path2ContainsPath1(or2->pts, or1->pts))
2320 {
2321 or2->owner = or1;
2322 }
2323 else
2324 or2->owner = or1->owner;
2325
2326 if (!or1->splits) or1->splits = new OutRecList();
2327 or1->splits->emplace_back(or2);
2328 }
2329 else
2330 or2->owner = or1;
2331 }
2332 else // joining, not splitting
2333 {
2334 or2->pts = nullptr;
2335 if (using_polytree_)
2336 {

Callers

nothing calls this directly

Calls 5

GetRealOutRecFunction · 0.85
FixOutRecPtsFunction · 0.85
SetOwnerFunction · 0.85
MoveSplitsFunction · 0.85
Path2ContainsPath1Function · 0.70

Tested by

no test coverage detected