Box2
new Box2(min?: Vector2, max?: Vector2)THREE equivalent: THREE.Box2
2D axis-aligned bounding box defined by min and max corners.
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
min |
Vector2 |
Lower-left corner. |
max |
Vector2 |
Upper-right corner. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
set(min: Vector2, max: Vector2): this |
Sets both corners. |
expandByPoint(point: Vector2): this |
Expands the box to include the point. |
containsPoint(point: Vector2): boolean |
Returns true if the point is inside the box. |
intersectsBox(box: Box2): boolean |
Returns true if the boxes overlap. |
getCenter(target?: Vector2): Vector2 |
Returns the center point. |
getSize(target?: Vector2): Vector2 |
Returns the width/height as a Vector2. |
clone(): Box2 |
Returns a new Box2 with the same bounds. |