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

Method AddLocalMaxPoly

CSharp/Clipper2Lib/Clipper.Engine.cs:1344–1394  ·  view source on GitHub ↗
(Active ae1, Active ae2, Point64 pt)

Source from the content-addressed store, hash-verified

1342 }
1343
1344 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1345 private OutPt? AddLocalMaxPoly(Active ae1, Active ae2, Point64 pt)
1346 {
1347 if (IsJoined(ae1)) Split(ae1, pt);
1348 if (IsJoined(ae2)) Split(ae2, pt);
1349
1350 if (IsFront(ae1) == IsFront(ae2))
1351 {
1352 if (IsOpenEnd(ae1))
1353 SwapFrontBackSides(ae1.outrec!);
1354 else if (IsOpenEnd(ae2))
1355 SwapFrontBackSides(ae2.outrec!);
1356 else
1357 {
1358 _succeeded = false;
1359 return null;
1360 }
1361 }
1362
1363 OutPt result = AddOutPt(ae1, pt);
1364 if (ae1.outrec == ae2.outrec)
1365 {
1366 OutRec outrec = ae1.outrec!;
1367 outrec.pts = result;
1368
1369 if (_using_polytree)
1370 {
1371 Active? e = GetPrevHotEdge(ae1);
1372 if (e == null)
1373 outrec.owner = null;
1374 else
1375 SetOwner(outrec, e.outrec!);
1376 // nb: outRec.owner here is likely NOT the real
1377 // owner but this will be fixed in DeepCheckOwner()
1378 }
1379 UncoupleOutRec(ae1);
1380 }
1381 // and to preserve the winding orientation of outrec ...
1382 else if (IsOpen(ae1))
1383 {
1384 if (ae1.windDx < 0)
1385 JoinOutrecPaths(ae1, ae2);
1386 else
1387 JoinOutrecPaths(ae2, ae1);
1388 }
1389 else if (ae1.outrec!.idx < ae2.outrec!.idx)
1390 JoinOutrecPaths(ae1, ae2);
1391 else
1392 JoinOutrecPaths(ae2, ae1);
1393 return result;
1394 }
1395
1396 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1397 private static void JoinOutrecPaths(Active ae1, Active ae2)

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected