title: Rectangular collision detection
body: <pre><code>class Rectangle{
  public:
     float x, y, width, height;
     // (x,y) is the lower left corner of the rectangle
  };
  </code></pre>
  
  <p>Is this algorithm correct?</p>
  
  <pre><code>bool Rectangle::colidesWith(Rectangle other) {
     if (x+width &lt; other.x) return false; // "other" is on the far right
     if (other.x+other.width &lt; x) return false; //"other" is on the far left
     if (y+height &lt; other.y) return false // "other" is up
     if (other.y+other.height &lt; y) return false // "other" is down
     return true;
  }
  </code></pre>