View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [2D] Bonding Box of collision region of 2 rectangles

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Makers_F  Members

Posted 24 July 2012 - 12:56 PM

Hello,
i'm implementing pixel perfect collision, and in order to make the check faster i want to cull the unused part of the 2 sprites colliding.
I need to find the red area in the pictures (the rectangles can be scaled, rotated, screwed), possibly the one from the last 2 pictures(where the rectangle is parallel to one of the 2 rectangles), but i'm a little confused. I have the vertices in world space, but i can't figure a way to correctly test the right intersections(for each way i think it could be done i can think of a corner case in which it is wrong).

Is there some algorithm to perform this check? I wasn't able to find one, despite the fact it should be a well studied/known subject (at least, i thought 2D collision is a well known and already deeply studied subject..)

bounding box parallel to the world space axis.

bounding box parallel to the local X axis of one of the 2 rectangles
Ps: i have the transformation matrices of both the rectangles

### #2Faelenor  Members

Posted 24 July 2012 - 02:19 PM

Hmm, I don't know if there's a better way to do it, but you could probably just clip one rectangle with the other one? You can maybe have better answers if you post this in the Math/Physics forum too.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.