Skip to content

Commit df61525

Browse files
committed
Improved testing for excessive offset shrinking //#651
1 parent 0983504 commit df61525

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Delphi/Clipper2Lib/Clipper.Offset.pas

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

33
(*******************************************************************************
44
* Author : Angus Johnson *
5-
* Date : 16 September 2023 *
5+
* Date : 19 September 2023 *
66
* Website : http://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2023 *
88
* Purpose : Path Offset (Inflate/Shrink) *
@@ -430,7 +430,7 @@ procedure TClipperOffset.BuildNormals;
430430
procedure TClipperOffset.OffsetPolygon;
431431
var
432432
i,j: integer;
433-
a: double;
433+
a, offsetMinDim: double;
434434
rec: TRect64;
435435
begin
436436
//when the path is contracting, make sure
@@ -440,7 +440,8 @@ procedure TClipperOffset.OffsetPolygon;
440440
if (a < 0) <> (fGroupDelta < 0) then
441441
begin
442442
rec := GetBounds(fInPath);
443-
if Abs(fGroupDelta) * 2 >= rec.Width then Exit;
443+
offsetMinDim := Abs(fGroupDelta) * 2;
444+
if (offsetMinDim >= rec.Width) or (offsetMinDim >= rec.Height) then Exit;
444445
end;
445446

446447
j := high(fInPath);

0 commit comments

Comments
 (0)