Skip to content

Commit b6e9ec1

Browse files
committed
Clipper.Engine.pas - fixed bug introduced in recent update. (Delphi only)
1 parent ccdd052 commit b6e9ec1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Delphi/Clipper2Lib/Clipper.Engine.pas

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
(*******************************************************************************
44
* Author : Angus Johnson *
5-
* Date : 4 May 2025 *
5+
* Date : 10 May 2025 *
66
* Website : https://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2025 *
88
* Purpose : This is the main polygon clipping module *
@@ -2191,8 +2191,8 @@ procedure TClipperBase.DoSplitOp(outrec: POutRec; splitOp: POutPt);
21912191
// splitOp, splitOp.next and the intesect pt, if area1 and area2 have the
21922192
// same sign then area2 must be the larger of the splits.
21932193

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
21962196
begin
21972197
Dispose(splitOp.next);
21982198
Dispose(splitOp);
@@ -3120,7 +3120,8 @@ procedure TClipperBase.ProcessHorzJoins;
31203120
end
31213121
else
31223122
or2.owner := or1;
3123-
end else // or1 <> or2
3123+
end
3124+
else // or1 <> or2, hence joining not splitting
31243125
begin
31253126
or2.pts := nil;
31263127
if FUsingPolytree then
@@ -3745,19 +3746,19 @@ function TClipperBase.CheckSplitOwner(outrec: POutRec; const splits: TOutRecArra
37453746
begin
37463747
split := splits[i];
37473748
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)
37493750

37503751
split := GetRealOutRec(split);
3751-
if (split = nil) or (split = outrec) or
3752+
if not Assigned(split) or (split = outrec) or
37523753
(split.recursiveCheck = outrec) then Continue;
3753-
37543754
split.recursiveCheck := outrec; // prevent infinite loops
3755+
37553756
if Assigned(split.splits) and CheckSplitOwner(outrec, split.splits) then
37563757
Exit; // Result := true
37573758

37583759
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;
37613762

37623763
if not IsValidOwner(outrec, split) then // split is owned by outrec (#957)
37633764
split.owner := outrec.owner;

0 commit comments

Comments
 (0)