Last updated

API / geotoolkit3d / util / OrientedBoundingBox / OrientedBoundingBox

Class: OrientedBoundingBox

util.OrientedBoundingBox.OrientedBoundingBox

Represents an oriented bounding box (OBB) in 3D space.
It's different from axis-aligned bounding box i.e. THREE.Box3

Table of contents

Constructors
Methods

Contents

Constructors

new OrientedBoundingBox(center, halfSize, rotation)

new OrientedBoundingBox(center?, halfSize?, rotation?)

Oriented BoundingBox Constructor

Parameters

Name Type Description
Optional centerVector3the center point of this OBB
Optional halfSizeVector3positive halfwidth extents of the OBB along each axis
Optional rotationMatrix3the rotation of this OBB
Methods

clone

clone(): OrientedBoundingBox

Copies the properties of the given OBB to this OBB

Returns

OrientedBoundingBox


containsPoint

containsPoint(point): boolean

Whether the given point lies within this OBB or not

Parameters

Name Type Description
pointVector3the point to test

Returns

boolean


copy

copy(obb): OrientedBoundingBox

Copies the properties of the given OBB

Parameters

Name Type Description
obbOrientedBoundingBoxthe obb to copy

Returns

OrientedBoundingBox

this


equals

equals(obb): boolean

Whether the given OBB is equal to this OBB or not

Parameters

Name Type Description
obbOrientedBoundingBoxthe OBB to test

Returns

boolean


fromBox3

fromBox3(box3): OrientedBoundingBox

Define an OBB based on the given standard bounding box

Parameters

Name Type Description
box3Box3standard bounding box

Returns

OrientedBoundingBox

this


fromBox3WithTransformation

fromBox3WithTransformation(aabb, matrix): OrientedBoundingBox

Define this OBB based on the given AABB box and transformation matrix (essentially used when a AABB must receive a transformation/rotation, but we want to keep the box as small as possible for precision)

Parameters

Name Type Description
aabbBox3AABB box
matrixMatrix4matrix to transform the given AABB box.

Returns

OrientedBoundingBox

this


getCenter

getCenter(): Vector3

Get the center of this OBB

Returns

Vector3

center


getClassName

getClassName(): string

Returns

string


getHalfSize

getHalfSize(): Vector3

Get the half size of this OBB

Returns

Vector3

halfsize


getRotation

getRotation(): Matrix3

Get the rotation matrix of this OBB

Returns

Matrix3

rotation


intersectsBox3

intersectsBox3(box3): boolean

Whether the given box3 intersects this OBB or not

Parameters

Name Type Description
box3Box3the box3 to test

Returns

boolean


intersectsOrientedBoundingBox

intersectsOrientedBoundingBox(obb, epsilon?): boolean

Return whether the given OBB intersects this OBB or not

Parameters

Name Type Description
obbOrientedBoundingBoxthe OBB to test
Optional epsilonnumberan optional numeric value to counteract arithmetic errors

Returns

boolean


intersectsPlane

intersectsPlane(plane): boolean

Whether the given plane intersects this OBB or not

Parameters

Name Type Description
planePlanethe plane to test

Returns

boolean


set

set(center, halfSize, rotation): OrientedBoundingBox

Set center, halfSize, rotation for this OBB

Parameters

Name Type Description
centerVector3the center point of this OBB
halfSizeVector3positive halfwidth extents of the OBB along each axis
rotationMatrix3the rotation of this OBB

Returns

OrientedBoundingBox

this


setCenter

setCenter(center): OrientedBoundingBox

Set center for this OBB

Parameters

Name Type Description
centerVector3the center point of this OBB

Returns

OrientedBoundingBox

this


setHalfSize

setHalfSize(halfSize): OrientedBoundingBox

Set halfSize for this OBB

Parameters

Name Type Description
halfSizeVector3the center point of this OBB

Returns

OrientedBoundingBox

this


setRotation

setRotation(rotation): OrientedBoundingBox

Set rotation for this OBB

Parameters

Name Type Description
rotationMatrix3the rotation of this OBB

Returns

OrientedBoundingBox

this


toThreeBox

toThreeBox(target?): Box3

Set/create a THREE.Box3 from this orientedBoundingBox. The resulting THREE.Box3 might be bigger based on orientation.

Parameters

Name Type Description
Optional targetBox3optional Box3 to set from this orientedBoundingBox.

Returns

Box3


getClassName

Static getClassName(): string

Returns

string