How can I perform Collision Detection on rotated rectangles? [closed]
Asked Answered
D

0

21

Okay, I'm trying to write a program that could tell me if any points in a 30x100 rectangle rotated to 140 degrees are inside another 30x100 rectangle rotated to 200 degrees.

Honestly, I don't even know where to start. I thought about re-rotating them before doing normal calculations, but than they still wouldn't match up.

How can I do this?

Donell answered 13/3, 2009 at 2:7 Comment(4)
So you're basically looking for the intersection between two non-axis-aligned rectangles? (Or, if they collide at all?)Conceit
Google provides 2D rotated rectangle collision on GameDev.net.Conceit
@Daniel L, I would assume the Z axis, as the questioner is probably talking about 2D rectangles in 2D space.Conceit
@Daniel: It's not only a parallelogram, it's still a rectangle - rotating it will never change that. It doesn't matter if you're rotating about the center, or a corner, or some other point in 2D-space.Lunchroom

© 2022 - 2024 — McMap. All rights reserved.