Home

# Class goog.math.Rect

Class for representing rectangular regions.

Instance Method Summary
| `boundingRect(?goog.math.Rect rect)` Expand this rectangle to also include the area of the given rectangle.
| `clone() ⇒ !goog.math.Rect` Returns a new copy of the rectangle.
| `contains((goog.math.Coordinate|goog.math.Rect|null) another) ⇒ boolean` Tests whether this rectangle entirely contains another rectangle or coordinate.
| `difference(?goog.math.Rect rect) ⇒ !Array` Computes the difference regions between this rectangle and {@code rect}. The return value is an array of 0 to 4 rectangles defining the remaining regions of this rectangle after the other has been subtracted.
| `getSize() ⇒ !goog.math.Size` Returns the size of this rectangle.
| `intersection(?goog.math.Rect rect) ⇒ boolean` Computes the intersection of this rectangle and the rectangle parameter. If there is no intersection, returns false and leaves this rectangle as is.
| `intersects(?goog.math.Rect rect) ⇒ boolean` Returns whether a rectangle intersects this rectangle.
| `toBox() ⇒ !goog.math.Box` Returns a new Box object with the same position and dimensions as this rectangle.
| `toString() ⇒ string` Returns a nice string representing size and dimensions of rectangle.

Static Method Summary
| `boundingRect(?goog.math.Rect a, ?goog.math.Rect b) ⇒ ?goog.math.Rect` Returns a new rectangle which completely contains both input rectangles.
| `createFromBox(?goog.math.Box box) ⇒ !goog.math.Rect` Creates a new Rect object with the same position and dimensions as a given Box. Note that this is only the inverse of toBox if left/top are defined.
| `difference(?goog.math.Rect a, ?goog.math.Rect b) ⇒ !Array` Computes the difference regions between two rectangles. The return value is an array of 0 to 4 rectangles defining the remaining regions of the first rectangle after the second has been subtracted.
| `equals(?goog.math.Rect a, ?goog.math.Rect b) ⇒ boolean` Compares rectangles for equality.
| `intersection(?goog.math.Rect a, ?goog.math.Rect b) ⇒ ?goog.math.Rect` Returns the intersection of two rectangles. Two rectangles intersect if they touch at all, for example, two zero width and height rectangles would intersect if they had the same top and left.
| `intersects(?goog.math.Rect a, ?goog.math.Rect b) ⇒ boolean` Returns whether two rectangles intersect. Two rectangles intersect if they touch at all, for example, two zero width and height rectangles would intersect if they had the same top and left.