SRL Archive - SRL Suggestions

function PointInCircle(P, Center: TPoint; Radius: Extended): Boolean


Runaway

2012-06-24 00:26:22

I'm back again with another suggestion that might already exist! I should really stop making suggestions when I'm not on my computer, but whatever :p


function PointInCircle(P, Center: TPoint; Radius: Extended): Boolean;
var
Dist: Extended;
begin
Result := False;
Dist := Distance(P.x, P.y, Center.x, Center.y);
if (Dist <= Radius) then
Result := True;
end;

CephaXz

2012-06-24 00:51:14

Lol I was gonna make a function totally almost same as this. Your functions are always useful. Making a wildy agility course script with FindTPointCluster, am surprised how good it worked by using the function with MMtoMS and for walking.

Runaway

2012-06-24 12:37:12

From: CephaXz
Lol I was gonna make a function totally almost same as this. Your functions are always useful. Making a wildy agility course script with FindTPointCluster, am surprised how good it worked by using the function with MMtoMS and for walking.


Haha I don't know if this is on the same level as my cluster functions :p Thanks though.

Did some searching and of course this is already a function. I suggest InBox and there's already a PointInBox. So I figure, "I doubt it's InCircle since it was PointInBox", but apparently that was a silly assumption.


function InCircle(x, y, mx, my, r: Integer): Boolean;
begin
result := (Sqrt(sqr(x-mx) + sqr(y-my)) <= r);
end;

Close this thread I guess :duh: