{*******************************************************************************
function RearrangeAOTPAByLength (TheAOTPA:array of array of tpoint; Increasing:boolean):array of array of tpoint;
By: Boreas
Description: Sorts an array of array of tpoint by length of arrays. Increasing=true
makes Result[0] have the smallest array length. Does not touch the tpoints within the arrays.
*******************************************************************************}
function RearrangeAOTPAByLength (TheAOTPA:array of array of tpoint; Increasing:boolean):array of array of tpoint;
var done:boolean;
AL,parray:integer;
ttpa:array of tpoint;
begin
result:=TheAOTPA;
AL:=getarraylength(result);
if Increasing then
begin
repeat
done := True;
for pArray := 0 to (AL - 2) do
begin
if (getarraylength(result[pArray]) > getarraylength(result[pArray + 1])) then
begin
ttpa := result[pArray];
result[pArray] := result[pArray + 1];
result[pArray + 1] := ttpa;
done := False;
end;
end;
until (done);
end;
if not Increasing then
begin
repeat
done := True;
for pArray := 0 to (AL - 2) do
begin
if (getarraylength(result[pArray]) < getarraylength(result[pArray + 1])) then
begin
ttpa := result[pArray];
result[pArray] := result[pArray + 1];
result[pArray + 1] := ttpa;
done := False;
end;
end;
until (done);
end;
end;