Constructor
new BoundingBox(min_x, min_y, width, height)
Creates a new bounding box from a minimum x-coordinate, minimum y-coordinate, width, and height.
Name | Type | Description |
---|---|---|
min_x | number | The minimum x-coordinate of the bounding box. |
min_y | number | The minimum y-coordinate of the bounding box. |
width | number | The width of the bounding box. |
height | number | The height of the bounding box. |
- Source
Classes
Members
center
Returns the center point of the bounding box.
- Source
height
Gets the height of the bounding box.
- Source
min_x
Gets the minimum x-coordinate of the bounding box.
- Source
min_y
Gets the minimum y-coordinate of the bounding box.
- Source
width
Gets the width of the bounding box.
- Source
Methods
clone() → {BoundingBox}
Clones the bounding box.
- Source
- Type:
- BoundingBox
contains(point) → {boolean}
Checks if a point is contained within the bounding box.
Name | Type | Description |
---|---|---|
point | Point2D | The point to check if it is contained within the bounding box. |
- Source
A boolean indicating if the point is contained within the bounding box.
- Type:
- boolean
intersects(other) → {boolean}
Checks if the bounding box overlaps with another bounding box.
Name | Type | Description |
---|---|---|
other | BoundingBox | The other bounding box to check for intersection. |
- Source
A boolean indicating if the bounding box overlaps with the other bounding box.
- Type:
- boolean
(static) from_path(path) → {BoundingBox|undefined}
Creates the instance of a path's bounding box.
Name | Type | Description |
---|---|---|
path | Path2D | The path to calculate the bounding box of. |
- Source
The bounding box of the path.
- Type:
- BoundingBox |
undefined
(static) intersection(_thisopt, otheropt) → {BoundingBox|undefined}
Returns the intersection of the bounding box with another bounding box, it means the area that is common to both bounding boxes.
Name | Type | Attributes | Description |
---|---|---|---|
_this | BoundingBox | | <optional> | The bounding box to intersect with. |
other | BoundingBox | | <optional> | The other bounding box to intersect with. |
- Source
The intersection of the bounding box with the other bounding box.
- Type:
- BoundingBox |
undefined
(static) union(_thisopt, otheropt) → {BoundingBox|undefined}
Returns the union of the bounding box with another bounding box, it means the smallest bounding box that contains both bounding boxes.
Name | Type | Attributes | Description |
---|---|---|---|
_this | BoundingBox | | <optional> | The bounding box to union with. |
other | BoundingBox | | <optional> | The other bounding box to union with. |
- Source
The union of the bounding box with the other bounding box.
- Type:
- BoundingBox |
undefined