marpis
2010-07-01 10:24:41
Atm it's a procedure, but I think it should be a function that returned TPointArray.
2010-07-01 10:24:41
2010-07-01 10:27:41
2010-07-01 10:42:12
2010-07-01 12:48:33
From: Wizzup?
Why? If you want the original points back, you just invert it again. Or make a copy beforehand.
function InvertedTPA(TPA: TPointArray): TPointArray;
begin
Result := TPA;
InvertTPA(Result);
end;
2010-07-01 16:13:29
From: IceFire908
This^ that or just make your own.function InvertedTPA(TPA: TPointArray): TPointArray;
begin
Result := TPA;
InvertTPA(Result);
end;
2010-07-01 17:16:36
From: Wizzup?
Why? If you want the original points back, you just invert it again. Or make a copy beforehand.
2010-07-01 17:18:20
2010-07-01 17:27:28
From: Wizzup?
This does (or should) not work. You need to copy it manually.
{.include SRL\SRL.scar}
function InvertedTPA(TPA: TPointArray): TPointArray;
begin
Result := TPA;
InvertTPA(Result);
end;
procedure ListTPA(TPA: TPointArray);
var
I: LongInt;
begin
for I := 0 to High(TPA) do
WriteLn(IntToStr(TPA[I].X) + ', ' + IntToStr(TPA[I].Y));
end;
var
TPA, bTPA: TPointArray;
begin
TPA := [Point(0, 0), Point(1, 1), Point(2, 2)];
ListTPA(TPA);
bTPA := InvertedTPA(TPA);
ListTPA(bTPA);
end.Successfully compiled (4621 ms)
0, 0
1, 1
2, 2
2, 2
1, 1
0, 0
Successfully executed
2010-07-01 18:28:30
From: IceFire908
{.include SRL\SRL.scar}
function InvertedTPA(TPA: TPointArray): TPointArray;
begin
Result := TPA;
InvertTPA(Result);
end;
procedure ListTPA(TPA: TPointArray);
var
I: LongInt;
begin
for I := 0 to High(TPA) do
WriteLn(IntToStr(TPA[I].X) + ', ' + IntToStr(TPA[I].Y));
end;
var
TPA, bTPA: TPointArray;
begin
TPA := [Point(0, 0), Point(1, 1), Point(2, 2)];
ListTPA(TPA);
bTPA := InvertedTPA(TPA);
ListTPA(bTPA);
end.Successfully compiled (4621 ms)
0, 0
1, 1
2, 2
2, 2
1, 1
0, 0
Successfully executed
Seems to work fine, why wouldn't it work?
Agreed though, this is trivial.. the current system is fine/better
2010-07-01 20:00:58
From: Wizzup?
It shouldn't work as Arrays are technically Pointers, so you reference the same memory. But perhaps PascalScript does not do this. (It really should)
2010-07-02 06:35:12
From: Wizzup?
It shouldn't work as Arrays are technically Pointers, so you reference the same memory. But perhaps PascalScript does not do this. (It really should)
2010-07-02 06:59:54
From: Rasta Magician
And how else would we copy the array into memory?
~RM
SetArrayLength(TPA2, GetArrayLength(TPA));
H := High(TPA);
for I := 0 to H do
TPA2[I] := Point(TPA[I].X, TPA[I].Y);
2010-07-02 08:38:15
From: Zyt3x
SetArrayLength(TPA2, GetArrayLength(TPA));
H := High(TPA);
for I := 0 to H do
TPA2[I] := Point(TPA[I].X, TPA[I].Y);
function MirrorTPA(TPA: TPointArray): TPointArray;
var
i, h: integer;
begin d
h := 0;
SetLength(Result, Length(TPA));
for i := High(TPA) DownTo 0 do
begin
Result[h] := TPA[i];
Inc(h);
end;
end;
2010-07-02 09:17:17
Result[i] := TPA[i];
?