Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • If I understand your problem description correctly:

    This is a pretty common problem typical of interactive 2d applications (a.k.a video games).

    A good algorithm is really straightforward.

    Search for AABB (Axis-aligned bounding box) and OBB (Oriented bounding box) collision tests.

    Depending on the number of tests you need to do, speed may or may not be an issue. You can speed-up the solve time by testing in the following order:

    1. Do two BSs (bounding sphere) overlap?
    2. Now, do the AABBs overlap?
    3. Finally, do th
    • $many x $thanx;

      Your comments gave me much to search for and read about.

      Looks like the AABB is painless and the OBB is painful.
  • The rectangles _don't_ overlap when one is either completely to the left of the other, or completely below the other.

    A rectangle can be defined by the coordinates of its top-left and bottom-right points:

    So let's say A = (x1,y1,x2,y2) and B = (u1,v1,u2,v2).

    (x1,y1)                 (u1,v1)
      +-------------+           +-----------+
      |             |           |