Box2

new Box2(min?: Vector2, max?: Vector2)
THREE: THREE.Box2

2D axis-aligned bounding box defined by min and max corners.

Properties

NameTypeDescription
min

Vector2

Lower-left corner.

max

Vector2

Upper-right corner.

Methods

MethodDescription
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.