title: How to determine if there was a collision between a normal rectangle and a rotated rectangle?
body: <p>Determining whether or not there was a collision between two AABB (axis-aligned bounding box) rectangles is trivial:</p>
  <pre><code>doRectanglesCollide(r1X, r1Y, r1W, r1H, r2X, r2Y, r2W, r2H) {
    return r1X &lt; r2X + r2W &amp;&amp; r1X + r1W &gt; r2X &amp;&amp; r1Y &lt; r2Y + r2H &amp;&amp; r1Y + r1H &gt; r2Y;
  }
  </code></pre>
  <p>Determining whether or not there was a collision between two rotated rectangles is <a href="https://stackoverflow.com/a/12414951/962155">much less efficient.</a></p>
  <p>However, there is a trick. One can rotate both of the rectangles by the same amount such that one of them becomes an AABB rectangle.</p>
  <p>At that point, one would simply need a function that determines whether an AABB rectangle and a rotated rectangle intersect. I assume it would be much more efficient than using the Separating Axis Theorem to determine if two rotated rectangles are intersecting, as the latter is a general formula for determining if two arbitrary polygons are intersecting.</p>
  <p>So, to rephrase, here is my question: I have two rectangles that are rotated. Rather than using the linked answer, is there not a more efficient algorithm that takes advantage of the fact that one of the rectangles can be made into an AABB rectangle by rotating both of them by <code>-radians</code>? Because at that point it simply becomes the question of whether or not an AABB rectangle and a rotated rectangle are intersecting.</p>