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

Method AddLocalMaxPoly

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

Source from the content-addressed store, hash-verified

1378
1379
1380 OutPt* ClipperBase::AddLocalMaxPoly(Active& e1, Active& e2, const Point64& pt)
1381 {
1382 if (IsJoined(e1)) Split(e1, pt);
1383 if (IsJoined(e2)) Split(e2, pt);
1384
1385 if (IsFront(e1) == IsFront(e2))
1386 {
1387 if (IsOpenEnd(e1))
1388 SwapFrontBackSides(*e1.outrec);
1389 else if (IsOpenEnd(e2))
1390 SwapFrontBackSides(*e2.outrec);
1391 else
1392 {
1393 succeeded_ = false;
1394 return nullptr;
1395 }
1396 }
1397
1398 OutPt* result = AddOutPt(e1, pt);
1399 if (e1.outrec == e2.outrec)
1400 {
1401 OutRec& outrec = *e1.outrec;
1402 outrec.pts = result;
1403
1404 if (using_polytree_)
1405 {
1406 Active* e = GetPrevHotEdge(e1);
1407 if (!e)
1408 outrec.owner = nullptr;
1409 else
1410 SetOwner(&outrec, e->outrec);
1411 // nb: outRec.owner here is likely NOT the real
1412 // owner but this will be checked in RecursiveCheckOwners()
1413 }
1414
1415 UncoupleOutRec(e1);
1416 result = outrec.pts;
1417 if (outrec.owner && !outrec.owner->front_edge)
1418 outrec.owner = GetRealOutRec(outrec.owner);
1419 }
1420 //and to preserve the winding orientation of outrec ...
1421 else if (IsOpen(e1))
1422 {
1423 if (e1.wind_dx < 0)
1424 JoinOutrecPaths(e1, e2);
1425 else
1426 JoinOutrecPaths(e2, e1);
1427 }
1428 else if (e1.outrec->idx < e2.outrec->idx)
1429 JoinOutrecPaths(e1, e2);
1430 else
1431 JoinOutrecPaths(e2, e1);
1432 return result;
1433 }
1434
1435 void ClipperBase::JoinOutrecPaths(Active& e1, Active& e2)
1436 {

Callers

nothing calls this directly

Calls 9

IsJoinedFunction · 0.85
IsFrontFunction · 0.85
IsOpenEndFunction · 0.85
SwapFrontBackSidesFunction · 0.85
GetPrevHotEdgeFunction · 0.85
SetOwnerFunction · 0.85
UncoupleOutRecFunction · 0.85
GetRealOutRecFunction · 0.85
IsOpenFunction · 0.85

Tested by

no test coverage detected