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)
First we are going to implement the support functions needed for an SAT test between a Rectangle
and an OrientedRectangle
. We already have all the support functions for the Rectangle
implemented from the last section, now we have to implement these functions for the OrientedRectangle
. These functions...