SRL Archive - OSR Help

TPA help


skilld u

2010-04-25 20:34:46

is there any way to delete the outliers of a TPA? Like if a point is a certain distance away from the others it would be deleted.

Timer

2010-04-25 20:41:38

From: skilld u
is there any way to delete the outliers of a TPA? Like if a point is a certain distance away from the others it would be deleted.

You could just use like SplitTPA or TPAToATPA.
To remove outliers–it would be slow.. something like this:
procedure RemoveTPAL(var TPA: TPointArray; DistC: Integer);
var
i, ii, h: Integer;
arr: TPointArray;
begin
arr := TPA;
TPA := [];
h := High(arr);
for i := 0 to h do
for ii := 0 to h do
if (Distance(arr[i].x, arr[i].y, arr[ii].x, arr[ii].y) < DistC) and (not PointInTPA(arr[ii], TPA)) then
begin
SetLength(TPA, Length(TPA) + 1);
TPA[High(TPA)] := arr[ii];
end;
end;

YoHoJo

2010-04-25 20:42:37

// * procedure SortATPASize(var a: T2DPointArray; const BigFirst: Boolean); ?

{*******************************************************************************
function RemoveDistTPointArray(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
Description: Removes the points that are inside or outside the distance Dist
from the point (x, y) from the TPointArray ThePoints.
*******************************************************************************} ?

For I:=0 To High(TPA) Do
If TPA[I]> 20 Then
tpaSwap(TPA[I], TPA[High(TPA)]);
Bla Bla Shorten TPA?

:]! I DON'T KNOW ANYTHING!

Timer

2010-04-25 20:44:35

From: YoHoJo
// * procedure SortATPASize(var a: T2DPointArray; const BigFirst: Boolean); ?

{*******************************************************************************
function RemoveDistTPointArray(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
Description: Removes the points that are inside or outside the distance Dist
from the point (x, y) from the TPointArray ThePoints.
*******************************************************************************} ?

For I:=0 To High(TPA) Do
If TPA[I]> 20 Then
tpaSwap(TPA[I], TPA[High(TPA)]);
Bla Bla Shorten TPA?

:]! I DON'T KNOW ANYTHING!


Oh, I forget about that procedure, ignore my post. :(

YoHoJo

2010-04-25 20:50:57

I knew my little snippets of semi-remembrance would help!