SRL Archive - OSR Help

SortATPAFrom doesn't work /or/ how to use it?


bg5

2012-02-20 17:23:58

From: http://docs.wizzup.org
SortATPAFrom

procedure SortATPAFrom(var a: T2DPointArray; const From: TPoint);

Sorts the T2DPointArray a from the TPoint From


program new;
var ATPA :T2dPointarray;
begin
setlength(ATPA,5);
ATPA[0] := [Point(0,0)];
ATPA[1] := [Point(300,300)];
ATPA[2] := [Point(999,999)];
ATPA[3] := [Point(299,299)];
ATPA[4] := [Point(301,302)];

SortATPAFrom(ATPA ,Point(300,300));
writeln(ATPA);

end.

Compiled successfully in 16 ms.
[[(0, 0)], [(300, 300)], [(999, 999)], [(299, 299)], [(301, 302)]]
Successfully executed.

So it does nothing. Any suggestion?

mixster

2012-02-20 17:28:24

It sorts each array from the closest to the furthest from the point - since all your arrays only have one point, it's already sorted. You need to add more points into the individual arrays for it to actually change the order around.

bg5

2012-02-20 17:48:43

Ok ,I thought it sorts ATPA ,not TPoints in TPAs.