Sir R. M8gic1an
2009-05-03 00:33:43
sprang up in a discussion between me, nava, n3ss and mixster on how to detect if we're fishing… >.>
if placed in srl i think it'd probably fit best in math.scar
~RM
if placed in srl i think it'd probably fit best in math.scar
{*******************************************************************************
function TBoxInTBox(TB1, TB2: TBox): boolean;
By: Rasta Magician and mixster
Description: Returns true if one of the boxes overlaps the other
*******************************************************************************}
function TBoxInTBox(TB1, TB2: TBox): boolean;
begin
Result := false;
if not (InRange(TB1.x1, TB2.x1, TB2.x2) or
InRange(TB1.x2, TB2.x1, TB2.x2) or
InRange(TB2.x1, TB1.x1, TB1.x2) or
InRange(TB2.x2, TB1.x1, TB1.x2))
then
exit;
if not (InRange(TB1.y1, TB2.y1, TB2.y2) or
InRange(TB1.y2, TB2.y1, TB2.y2) or
InRange(TB2.y1, TB1.y1, TB1.y2) or
InRange(TB2.y2, TB1.y1, TB1.y2))
then
exit;
Result := true;
end;
~RM