Rectangle
Source: assist.
A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's upper-left point in the coordinate space, its width, and its height.
new Rectangle(x, y, width, height)
Rectangle constructor.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
x |
|
|
The x-coordinate of the upper-left corner of the rectangle. |
y |
|
|
The y-coordinate of the upper-left corner of the rectangle. |
width |
|
|
The width of the rectangle. |
height |
|
|
The height of the rectangle. |
Properties
height
The height of the Rectangle
.
width
The width of the Rectangle
.
x
The X coordinate of the upper-left corner of the Rectangle
.
y
The Y coordinate of the upper-left corner of the Rectangle
.
Methods
fromLTRB()
FromLTRB Shared Method Produces a Rectangle class from left, top, right, and bottom coordinates.
intersect()
Intersect Shared Method Produces a new Rectangle by intersecting 2 existing Rectangles. Returns null if there is no intersection.
getBottom()
Gets the y-coordinate that is the sum of the Y and Height property values of this Rectangle class.
- Returns
-
The y-coordinate that is the sum of Y and Height of this Rectangle.
getHeight()
Returns the height of the bounding Rectangle in double precision.
- Returns
-
the height of the bounding Rectangle.
getLeft()
Gets the x-coordinate of the left edge of this Rectangle class.
- Returns
-
The x-coordinate of the left edge of this Rectangle class.
getRight()
Gets the x-coordinate that is the sum of X and Width property values of this Rectangle class.
- Returns
-
The x-coordinate that is the sum of X and Width of this Rectangle.
getTop()
Gets the y-coordinate of the top edge of this Rectangle class.
- Returns
-
The y-coordinate of the top edge of this Rectangle class.
getWidth()
Returns the width of the bounding Rectangle in double precision.
- Returns
-
the width of the bounding Rectangle.
getX()
Returns the X coordinate of the bounding Rectangle in double precision.
- Returns
-
the X coordinate of the bounding Rectangle.
getY()
Returns the Y coordinate of the bounding Rectangle in double precision.
- Returns
-
the Y coordinate of the bounding Rectangle.
intersectsWithInclusive(rectangle) → boolean
Determines if this rectangle intersects with rect.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
rectangle |
|
|
- Returns
-
boolean