TRiLeZ
2009-12-03 19:24:33
{*******************************************************************************
function WhichRSQuadrant(x, y, OriginX, OriginY: Extended): Integer;
By: TRiLeZ
Description: Results the Quadrant in which a point is in. The first quadrant
is the top-right quadrant, which then increases in a clockwise order.
If the point is at the origin or between 2 quadrants, the result will be 0.
*******************************************************************************}
function WhichRSQuadrant(x, y, OriginX, OriginY: Extended): Integer;
begin
Result := 0;
if (x < OriginX) and (y < OriginY) then Result := 4 //Top-left Quadrant
else
if (x > OriginX) and (y < OriginY) then Result := 1 //Top-right Quadrant
else
if (x > OriginX) and (y > OriginY) then Result := 2 //Bottom-right Quadrant
else
if (x < OriginX) and (y > OriginY) then Result := 3; //Bottom-left Quadrant
end;
It's a useful function especially for my wood cutter I'm making. It determines which quadrant I clicked in on the RuneScape main screen and then waits while the tree colour is in a certain place in that quadrant (while cutting).
Tested and it works. :)
