SCAR Code:
{*********************************************************************************
function RestrictLine(Xi, Yi, Xc, Yc, Slope: Integer; RS, Top: Boolean): Boolean;
By: Main_Ftw, i luffs yeww
Description: Check if a point has passed a line.
Xi, Yi: Imput X and Y value.
Xc, Yc: Center of the line, the origin: Mmcx, Mmcy...etc
Slope: slope of the line, 0 to 1000.
Rs: Are you using it in runescape? This take cares of the inverted rs coordinate.
Top: Is the restricted area Above or under the line.
Example:
Top:=true;
|-Restricted/-----|
|--------------/------|
|-------------/-------|
|------------/--------|
|-----------/---------|
|----------/----------|
|---------/-----------|
|--------/------------|
Top:=false;
|------------/---------|
|-----------/----------|
|----------/-----------|
|---------/------------|
|--------/-------------|
|-------/--------------|
|------/---------------|
|-----/-Restricted-|
Example:
RestrictLine(0, 0, 50, 50, 1, true, true):
- This will result in true, because the input point (0,0) is in the restricted
area which is above line with slope of 1 at the point (50,50).
RestrictLine(0, 0, 50, 50, 1, true, false):
- This will result iin true, because the input point (0,0) is not in the restricted
area which is below line with slope of 1 at the point (50,50).
**********************************************************************************}
function RestrictLine(Xi, Yi, Xc, Yc, Slope: Integer; RS, Top: Boolean): Boolean;
var
Y: Integer;
begin
Y := -1 * slope * (Xi - Xc) + Yc;
if(Top)then
Result := not(Yi > Y)
else
Result := not(Yi < Y);
if(RS)then
Result := not(Result);
end;