You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During using shrinking of paths I got range error in procedure BuildNormals.
If pathlength is zero (len=0) fNorms[len-1] accesses element -1
procedure TClipperOffset.BuildNormals;
var
i, len: integer;
begin
len := Length(fInPath);
SetLength(fNorms, len);
for i := 0 to len-2 do
fNorms[i] := GetUnitNormal(fInPath[i], fInPath[i+1]); fNorms[len -1] := GetUnitNormal(fInPath[len -1], fInPath[0]);
end;
My suggest for fix (works fine in my project):
if len>0 then fNorms[len -1] := GetUnitNormal(fInPath[len -1], fInPath[0]);
Best regards
Andreas
The text was updated successfully, but these errors were encountered:
I am seeing the same exception when offsetting in C#.
Here is some minimal code that reproduces the issue.
using Clipper2Lib;
var path = new Path64 { new Point64(100, 100) };
var paths = new Paths64() { path };
var clipperOffset = new ClipperOffset();
clipperOffset.AddPaths(paths, JoinType.Miter, EndType.Polygon);
var solution = new Paths64();
clipperOffset.Execute(-10, solution);
Expected Result: Empty solution (as in previous Clipper versions)
Actual Result: Out of range exception.
During using shrinking of paths I got range error in procedure BuildNormals.
If pathlength is zero (len=0) fNorms[len-1] accesses element -1
My suggest for fix (works fine in my project):
if len>0 then fNorms[len -1] := GetUnitNormal(fInPath[len -1], fInPath[0]);
Best regards
Andreas
The text was updated successfully, but these errors were encountered: