diff --git a/CSharp/Clipper2Lib/Clipper.Offset.cs b/CSharp/Clipper2Lib/Clipper.Offset.cs index 1e03d37c..31ebcaea 100644 --- a/CSharp/Clipper2Lib/Clipper.Offset.cs +++ b/CSharp/Clipper2Lib/Clipper.Offset.cs @@ -1,6 +1,6 @@ /******************************************************************************* * Author : Angus Johnson * -* Date : 17 April 2024 * +* Date : 13 July 2024 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : Path Offset (Inflate/Shrink) * @@ -513,8 +513,8 @@ private void BuildNormals(Path64 path) { int cnt = path.Count; _normals.Clear(); + if (cnt == 0) return; _normals.EnsureCapacity(cnt); - for (int i = 0; i < cnt - 1; i++) _normals.Add(GetUnitNormal(path[i], path[i + 1])); _normals.Add(GetUnitNormal(path[cnt - 1], path[0])); diff --git a/Delphi/Clipper2Lib/Clipper.Offset.pas b/Delphi/Clipper2Lib/Clipper.Offset.pas index 7e7d99f0..f85be544 100644 --- a/Delphi/Clipper2Lib/Clipper.Offset.pas +++ b/Delphi/Clipper2Lib/Clipper.Offset.pas @@ -2,7 +2,7 @@ (******************************************************************************* * Author : Angus Johnson * -* Date : 17 April 2024 * +* Date : 6 July 2024 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : Path Offset (Inflate/Shrink) * @@ -236,9 +236,7 @@ function UnsafeGet(List: TList; Index: Integer): Pointer; constructor TGroup.Create(const pathsIn: TPaths64; jt: TJoinType; et: TEndType); var i, len: integer; - a: double; isJoined: boolean; - pb: PBoolean; begin Self.joinType := jt; Self.endType := et; @@ -345,7 +343,6 @@ procedure TClipperOffset.DoGroupOffset(group: TGroup); i,j, len, steps: Integer; r, stepsPer360, arcTol: Double; absDelta: double; - isShrinking: Boolean; rec: TRect64; pt0: TPoint64; begin @@ -450,6 +447,7 @@ procedure TClipperOffset.BuildNormals; begin len := Length(fInPath); SetLength(fNorms, len); + if len = 0 then Exit; for i := 0 to len-2 do fNorms[i] := GetUnitNormal(fInPath[i], fInPath[i+1]); fNorms[len -1] := GetUnitNormal(fInPath[len -1], fInPath[0]);