> can anyone tell me a quick algorithm to check for overlap of
>two rectangles that lie in the same plane and have the same orientation?
>(Note: must allow for the possibility that one is totally included in
>the other.)
then the low X of the other, or the high Y of one is less than the low Y of the
other, they DON'T overlap. Otherwise, they do. This can be determined in 4
comparisons:
if ((hi_x1 < lo_x2) || (hi_x2 < lo_x1) ||
(hi_y1 < lo_y2) || (hi_y2 < lo_y1))
{
They don't overlap
}
else
{
They do
}
If the sides are not parallel to the principal axes, but they have the same
orientation (ie, the sides are parallel to each other), then it might be easiest
to just transform the coordinates so they are parallel to the X and Y axes.