SRL Archive - Reflection Development

Path Reverser


ZaSz

2009-03-08 17:34:25

I made this cool program that reverses paths that have been made.

all you need to change is the code in r_path procedure.

I'm using this for ww1 so i dont have to do double the walking for the path I just made!

program New;

var
path : tpointarray;
b,i:integer;

const
length_of_result = 3;

function r_path:tpointarray;
begin
SetLength(Result, length_of_result);
result[0] := Point(3220, 3219);
result[1] := Point(3228, 3218);
result[2] := Point(3233, 3227);
end;

begin
cleardebug;
path := r_path;
b := high(path);
writeln('SetLength(Result, '+inttostr(b+1)+');');
b := 0;
for i := High(Path) downto 0 do
begin
b := b + 2;
WriteLn('result[' + IntToStr(i-(length_of_result-1)+(b-2)) + '] := Point(' + IntToStr(Path[i].X) + ', ' + IntToStr(Path[i].Y) + ');');
end;
end.

Would return.

SetLength(Result, 3);
result[0] := Point(3233, 3227);
result[1] := Point(3228, 3218);
result[2] := Point(3220, 3219);

It might be a little hard to get used to at first, but your welcome!

Method

2009-03-08 18:05:48

Can't this be done using InvertTPA from WizzyPlugin?

Bobarkinator

2009-03-08 18:18:45

From: Method
Can't this be done using InvertTPA from WizzyPlugin?


Yes :)

ZaSz

2009-03-08 18:21:09

I didn't know, but still yay me for effort?

Nava2

2009-03-09 20:42:44

Yay you, but they are right :)