This object represents a rectangle in a 2D space.
Constructor function.
var myObject = new Rect();
var myObject = new Rect(otherRect);
var myObject = new Rect(left, top, width, height);
Create a Rect representing an empty rectangle.
var myObject = new Rect();
Create a Rect representing a copy of otherRect.
var myObject = new Rect(otherRect);
Create a Rect representing a rectangle.
var myObject = new Rect(50, 75, 100, 100);
Returns a copy of this Rect.
myObject.clone();
var copyOfMyObject = myObject.clone();
Returns true if this Rect and another are referencing the same rectangle.
myObject.equals(other);
if(myFirstObject.equals(mySecondObject)) //Do something
Returns a string representing this Rect.
myObject.toString();
Console.print(myObject.toString());
This method is automatically called when trying to convert a Rect to a string.
Normalizes this Rect; sets it to a Rect that has a non-negative width and height.
myObject.normalize();
Sets the top value of this Rect.
myObject.setTop(top);
Sets the bottom value of this Rect.
myObject.setBottom(bottom);
Sets the left value of this Rect.
myObject.setLeft(left);
Sets the right value of this Rect.
myObject.setRight(right);
Sets the x value of this Rect.
myObject.setX(x);
Sets the y value of this Rect.
myObject.setY(y);
Sets the width of this Rect.
myObject.setWidth(width);
Sets the height of this Rect.
myObject.setHeight(height);
Sets the size of this Rect.
myObject.setSize(size);
Sets the coordinates of the rectangle's top-left corner to (x1, y1) and the coordinates of its bottom-right corner to (x2, y2).
myObject.setCoords(x1, y1, x2, y2);
Sets the rectangle of this Rect.
myObject.setRect(x, y, width, height);
Translates this Rect using a Point.
myObject.translate(point);
Returns true if a Point or a Rect is contained within this Rect.
myObject.contains(point);
myObject.contains(rect);
myObject.contains(x, y);
myObject.contains(left, top, width, height);
Returns the bounding rectangle of this Rect united with another Rect.
myObject.united(rect);
Returns the bounding rectangle of this Rect intersected with another Rect.
myObject.intersected(rect);
Returns true if this Rect intersects another.
myObject.intersects(rect);
Returns true if this Rect is empty.
myObject.isEmpty();
Returns a Point representing the center of this Rect.
myObject.center();
Returns a Size representing the size of this Rect.
myObject.size();
Returns the width of this Rect.
myObject.width();
Returns the height of this Rect.
myObject.height();
Returns the x coordinate of this Rect.
myObject.x();
Returns the y coordinate of this Rect.
myObject.y();
Returns the left coordinate of this Rect.
myObject.left();
Returns the right coordinate of this Rect.
myObject.right();
Returns the top coordinate of this Rect.
myObject.top();
Returns the bottom coordinate of this Rect.
myObject.bottom();
The width of this Point. (integer)
The height of this Point. (integer)
The x coordinate of this Point. (integer)
The y coordinate of this Point. (integer)
The left coordinate of this Point. (integer)
The right coordinate of this Point. (integer)
The top coordinate of this Point. (integer)
The bottom coordinate of this Point. (integer)