|
2 | 2 |
|
3 | 3 | (******************************************************************************* |
4 | 4 | * Author : Angus Johnson * |
5 | | -* Date : 4 May 2025 * |
| 5 | +* Date : 10 May 2025 * |
6 | 6 | * Website : https://www.angusj.com * |
7 | 7 | * Copyright : Angus Johnson 2010-2025 * |
8 | 8 | * Purpose : This is the main polygon clipping module * |
@@ -2191,8 +2191,8 @@ procedure TClipperBase.DoSplitOp(outrec: POutRec; splitOp: POutPt); |
2191 | 2191 | // splitOp, splitOp.next and the intesect pt, if area1 and area2 have the |
2192 | 2192 | // same sign then area2 must be the larger of the splits. |
2193 | 2193 |
|
2194 | | - |
2195 | | - if ((absArea2 < absArea1) and ((area2 > 0) <> (area1 > 0))) then |
| 2194 | + if (absArea2 < 1) or |
| 2195 | + ((absArea2 < absArea1) and ((area2 > 0) <> (area1 > 0))) then |
2196 | 2196 | begin |
2197 | 2197 | Dispose(splitOp.next); |
2198 | 2198 | Dispose(splitOp); |
@@ -3120,7 +3120,8 @@ procedure TClipperBase.ProcessHorzJoins; |
3120 | 3120 | end |
3121 | 3121 | else |
3122 | 3122 | or2.owner := or1; |
3123 | | - end else // or1 <> or2 |
| 3123 | + end |
| 3124 | + else // or1 <> or2, hence joining not splitting |
3124 | 3125 | begin |
3125 | 3126 | or2.pts := nil; |
3126 | 3127 | if FUsingPolytree then |
@@ -3745,19 +3746,19 @@ function TClipperBase.CheckSplitOwner(outrec: POutRec; const splits: TOutRecArra |
3745 | 3746 | begin |
3746 | 3747 | split := splits[i]; |
3747 | 3748 | if not Assigned(split.pts) and Assigned(split.splits) and |
3748 | | - CheckSplitOwner(outrec, split.splits) then Exit; // #942 |
| 3749 | + CheckSplitOwner(outrec, split.splits) then Exit; // Result := true (#942) |
3749 | 3750 |
|
3750 | 3751 | split := GetRealOutRec(split); |
3751 | | - if (split = nil) or (split = outrec) or |
| 3752 | + if not Assigned(split) or (split = outrec) or |
3752 | 3753 | (split.recursiveCheck = outrec) then Continue; |
3753 | | - |
3754 | 3754 | split.recursiveCheck := outrec; // prevent infinite loops |
| 3755 | + |
3755 | 3756 | if Assigned(split.splits) and CheckSplitOwner(outrec, split.splits) then |
3756 | 3757 | Exit; // Result := true |
3757 | 3758 |
|
3758 | 3759 | if not CheckBounds(split) or |
3759 | | - not (split.bounds.Contains(outrec.bounds) or |
3760 | | - not Path1InsidePath2(outrec.pts, split.pts)) then Continue; |
| 3760 | + not split.bounds.Contains(outrec.bounds) or |
| 3761 | + not Path1InsidePath2(outrec.pts, split.pts) then Continue; |
3761 | 3762 |
|
3762 | 3763 | if not IsValidOwner(outrec, split) then // split is owned by outrec (#957) |
3763 | 3764 | split.owner := outrec.owner; |
|
0 commit comments