title: Check if point is inside a rotated rectangle (with different rectangle origins)
body: <p>How can I check if a point is inside a rotaded rectangle when the rectangle can have different origins? This is basically what i'm using now:</p>
  
  <pre><code>struct Point 
  {
      float x;
      float y;
  };
  
  struct Rectangle
  {
      float x;
      float y;
      float w;
      float h;
      float origin;
      float rotation; // In degrees
  };
  
  bool contains(const Rectangle&amp; rect, const Point&amp; point)
  {
      float c = std::cos(toRadians(-rect.rotation));
      float s = std::sin(toRadians(-rect.rotation));
  
      float x  = rect.x;
      float y  = rect.y;
      float w  = rect.w;
      float h  = rect.h;
  
      float rotX = x + c * (point.x - x) - s * (point.y - y);
      float rotY = y + s * (point.x - x) + c * (point.y - y);
  
      float lx = x - w / 2.f;
      float rx = x + w / 2.f;
      float ty = y - h / 2.f;
      float by = y + h / 2.f;
  
      return lx &lt;= rotX &amp;&amp; rotX &lt;= rx &amp;&amp; ty &lt;= rotY &amp;&amp; rotY &lt;= by;
  }
  </code></pre>
  
  <p>
  This code does work when the origin is at the center of the rectangle but not in any other origins (that i have tested). How can i make it so it also works when the origin is for example at the top-left corner of the rectangle?</p>