in reply to Re^3: Checking if squares intersect
in thread Checking if squares intersect

But wouldn't the squares intersect if I changed to < to <= ?

Example, if x2 <= x3 then the statement is true if x2 intersects with x3 since x2 is the lower right corner and x3 is the upper left corner.

And yes, the x4 is missing, it was a typo.

Replies are listed 'Best First'.
Re^5: Checking if squares intersect
by ikegami (Patriarch) on Oct 14, 2009 at 21:13 UTC
    No. Adjacent squares don't intersect.
    x1 x2=x3 x4 +---------+ y1 | +---------+ y3 | | | | | | | | | +---------+ | y2 +---------+ y4
      If two lines can intersect in a point, can't two squares intersect in a point or a line?

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

      Adjacent squares would be side by side, in the above the edge of each square intersect.
      So x2=x3 means that the edge of one square intersects with the edge of the other...
        From a CS's perspective, at least in the era where I dealt with this, the bot right corner is usually just beyond the square itself.