Rectangle to oriented rectangle

Testing a rectangle against an oriented rectangle is not as easy as one would expect. If we translate the rectangle into the oriented rectangles space, we would end up with the non oriented rectangle being oriented, and the oriented rectangle becoming non-oriented.

We can perform an SAT test between the two rectangles. We do not have to perform the generic version of the SAT which should involve twenty four24 axes of potential separation. We can reduce rectangle to orientd rectangle to four axes of potential separation:

  • The global X Axis (1, 0)
  • The global Y Axis (0, 1)
  • The oriented rectangles X axis (rotation.X, 0)
  • The oriented rectangles Y axis (0, rotation.Y)

Getting ready

First we are going to implement the support ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.