[]
• new Rect(x
, y
, w
, h
)
Represents a rectangle with a special location, and its width and height in two-dimensional space.
Name | Type | Description |
---|---|---|
x |
number |
The x-coordinate of the top-left corner of the rectangle. |
y |
number |
The y-coordinate of the top-left corner of the rectangle. |
w |
number |
The width of the rectangle. |
h |
number |
The height of the rectangle. |
• height: number
The width of the rectangle.
• width: number
The height of the rectangle.
• x: number
The x-coordinate of the top-left corner of the rectangle.
• y: number
The y-coordinate of the top-left corner of the rectangle.
▸ contains(x
, y
): boolean
Indicates whether the rectangle contains the specified x-coordinate and y-coordinate.
Name | Type | Description |
---|---|---|
x |
number |
The x-coordinate of the point to check. |
y |
number |
The y-coordinate of the point to check. |
boolean
true
if (x, y) is contained by the rectangle; otherwise, false
.
▸ getIntersectRect(x
, y
, width
, height
): Rect
Gets the rectangle that intersects with the current rectangle.
Name | Type |
---|---|
x |
number |
y |
number |
width |
number |
height |
number |
The intersecting rectangle. If the two rectangles do not intersect, returns null.
▸ intersect(x
, y
, width
, height
): boolean
Indicates whether the specified rectangle intersects with the current rectangle.
Name | Type | Description |
---|---|---|
x |
number |
The x-coordinate of the top-left corner of the rectangle. |
y |
number |
The y-coordinate of the top-left corner of the rectangle. |
width |
number |
- |
height |
number |
- |
boolean
true
if the specified rectangle intersects with the current rectangle; otherwise, false
.
▸ intersectRect(rect
): boolean
Indicates whether the specified rectangle intersects with the current rectangle.
Name | Type | Description |
---|---|---|
rect |
Rect |
The specified rectangle. |
boolean
true
if the specified rectangle intersects with the current rectangle; otherwise, false
.