[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

[property:Vector3 center]

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

[property:Vector3 halfSize]

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

[property:Matrix3 rotation]

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

Methods

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

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

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

[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].

[method:OBB clone]()

Creates a cloned [name] for this instance.

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

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

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

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

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

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

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

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

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

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

[page:Box3 box3] — An AABB.

Defines an [name] based on the given AABB.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[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]