Skip to content

Commit f36666b

Browse files
committed
fix: rename TPA.TotalDistance to TPA.PolylineLength
1 parent 8e67691 commit f36666b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

utils/math/geometry.simba

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ end;
7777

7878
function T2DPointArray.InSameTPA(p, q: TPoint): Boolean;
7979
var
80-
i: Int32;
80+
i: Integer;
8181
begin
8282
for i := 0 to High(Self) do
8383
with Self[i].Bounds() do
@@ -88,13 +88,13 @@ begin
8888
end;
8989
end;
9090

91-
function TPointArray.TotalDistance(): Double;
91+
function TPointArray.PolylineLength(): Double;
9292
var
93-
i: Int32;
93+
i: Integer;
9494
begin
95-
for i := 0 to High(Self) do
96-
if i < High(Self) then
97-
Result += Self[i].DistanceTo(Self[i+1]);
95+
if Length(Self) < 2 then Exit;
96+
for i := 0 to Length(Self) do
97+
Result += Self[i].DistanceTo(Self[i+1]);
9898
end;
9999

100100

0 commit comments

Comments
 (0)