[name]

Represents an oriented bounding box (OBB) in 3D space.

Examples

[example:webgl_math_obb]

Constructor

[name]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )

[page:Vector3 center] — The center of the [name]. (optional)
[page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis. (optional)
[page:Matrix3 rotation] — The rotation of the [name]. (optional)

Creates a new [name].

Properties

.center : Vector3

The center of the [name]. Default is *( 0, 0, 0 )*.

.halfSize : Vector3

Positive halfwidth extents of the [name] along each axis. Default is *( 0, 0, 0 )*.

.rotation : Matrix3

The rotation of the [name]. Default is the identity matrix.

Methods

.applyMatrix4 ( [param:Matrix4 matrix] ) : this

[page:Matrix4 matrix] — A 4x4 transformation matrix.

Applies the given transformation matrix to this [name]. This method can be used to transform the bounding volume with the world matrix of a 3D object in order to keep both entities in sync.

.clampPoint ( [param:Vector3 point], [param:Vector3 clampedPoint] ) : Vector3

[page:Vector3 point] — The point that should be clamped within the bounds of this [name].
[page:Matrix3 clampedPoint] — The result will be copied into this vector.

Clamps the given point within the bounds of this [name].

.clone () : OBB

Creates a cloned [name] for this instance.

.containsPoint ( [param:Vector3 point] ) : Boolean

[page:Vector3 point] — The point to test.

Whether the given point lies within this [name] or not.

.copy ( [param:OBB obb] ) : this

[page:OBB obb] — The [name] to copy.

Copies the properties of the given [name] to this [name].

.equals ( [param:OBB obb] ) : Boolean

[page:OBB obb] — The [name] to test.

Whether the given [name] is equal to this [name] or not.

.fromBox3 ( [param:Box3 box3] ) : this

[page:Box3 box3] — An AABB.

Defines an [name] based on the given AABB.

.getSize ( [param:Vector3 size] ) : Vector3

[page:Vector3 size] — The result will be copied into this vector.

Returns the size of this [name] into the given vector.

.intersectsBox3 ( [param:Box3 box3] ) : Boolean

[page:Box3 box3] — The AABB to test.

Whether the given AABB intersects this [name] or not.

.intersectsSphere ( [param:Sphere sphere] ) : Boolean

[page:Sphere sphere] — The bounding sphere to test.

Whether the given bounding sphere intersects this [name] or not.

.intersectsOBB ( [param:OBB obb], [param:Number epsilon] ) : Boolean

[page:OBB obb] — The OBB to test.
[page:Number epsilon] — An optional numeric value to counteract arithmetic errors. Default is `Number.EPSILON`.

Whether the given [name] intersects this [name] or not.

.intersectsRay ( [param:Ray ray] ) : Boolean

[page:Ray ray] — The ray to test.

Whether the given ray intersects this [name] or not.

.intersectRay ( [param:Ray ray], [param:Vector3 intersectionPoint] ) : Vector3

[page:Ray ray] — The ray to test.
[page:Vector3 intersectionPoint] — The result will be copied into this vector.

Performs a Ray/OBB intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, `null` is returned.

.set ( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] ) : this

[page:Vector3 center] — The center of the [name].
[page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis.
[page:Matrix3 rotation] — The rotation of the [name].

Defines the [name] for the given values.

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/OBB.js examples/jsm/math/OBB.js]

OBB OBB OBB OBB

OBB OBB OBB OBB