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?

strager
  • 88,763
  • 26
  • 134
  • 176
William
  • 8,630
  • 23
  • 77
  • 110
  • So you're basically looking for the intersection between two non-axis-aligned rectangles? (Or, if they collide at all?) – strager Mar 13 '09 at 02:16
  • 1
    @Daniel L, I would assume the Z axis, as the questioner is probably talking about 2D rectangles in 2D space. – strager Mar 13 '09 at 02:24
  • @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. – BlueRaja - Danny Pflughoeft Jan 23 '12 at 20:00
  • 4
    Google provides [2D rotated rectangle collision on GameDev.net](http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604). – strager Mar 13 '09 at 02:17

0 Answers0