Awkwardsaw
2009-12-05 20:49:39
this should counvert a normal point into a Polar Point, :p
i know there is a function in scar, but i dont know how to use the PPoint, since its properties doesnt show up in ctrl + space :p
feedback pl0x
i know there is a function in scar, but i dont know how to use the PPoint, since its properties doesnt show up in ctrl + space :p
program New;
{.Include SRL/SRL.scar}
type
TPolarPoint = record
rad, theta : integer;
end;
function get_polar(x, y: integer; mr : integer): TPolarPoint;
var
t : TPoint;
begin
if not InCircle(x, y, 0, 0, mr) then exit;
result.rad := mr;
while InCircle(x, y, 0, 0, result.rad) do
begin
result.rad := result.rad - 1;
if result.rad <= 0 then
exit;
end;
result.theta := 360;
t := point(0, 0);
while inAngle(t, 0, result.theta, 0, result.rad, X, Y) do
begin
result.theta := result.theta - 2;
if result.theta < 0 then
begin
result.theta := 0;
exit;
end;
wait(1);
end;
end;
var p : TPolarPoint;
begin
p := get_polar(1, 1, 5);
writeln(inttostr(p.rad) + ' ' + inttostr(p.theta));
end.
feedback pl0x