123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">
- Represents an oriented bounding box (OBB) in 3D space.
- </p>
- <h2>Import</h2>
- <p>
- [name] is an add-on, and must be imported explicitly.
- See [link:#manual/introduction/Installation Installation / Addons].
- </p>
- <code>
- import { OBB } from 'three/addons/math/OBB.js';
- </code>
- <h2>Examples</h2>
- <p>
- [example:webgl_math_obb]
- </p>
- <h2>Constructor</h2>
- <h3>[name]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
- <p>
- [page:Vector3 center] — The center of the [name]. (optional)<br />
- [page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis. (optional)<br />
- [page:Matrix3 rotation] — The rotation of the [name]. (optional)
- </p>
- <p>
- Creates a new [name].
- </p>
- <h2>Properties</h2>
- <h3>[property:Vector3 center]</h3>
- <p>
- The center of the [name]. Default is *( 0, 0, 0 )*.
- </p>
- <h3>[property:Vector3 halfSize]</h3>
- <p>
- Positive halfwidth extents of the [name] along each axis. Default is *( 0, 0, 0 )*.
- </p>
- <h3>[property:Matrix3 rotation]</h3>
- <p>
- The rotation of the [name]. Default is the identity matrix.
- </p>
- <h2>Methods</h2>
- <h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
- <p>
- [page:Matrix4 matrix] — A 4x4 transformation matrix.
- </p>
- <p>
- 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.
- </p>
- <h3>[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 clampedPoint] )</h3>
- <p>
- [page:Vector3 point] — The point that should be clamped within the bounds of this [name].<br />
- [page:Matrix3 clampedPoint] — The result will be copied into this vector.
- </p>
- <p>
- Clamps the given point within the bounds of this [name].
- </p>
- <h3>[method:OBB clone]()</h3>
- <p>
- Creates a cloned [name] for this instance.
- </p>
- <h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
- <p>
- [page:Vector3 point] — The point to test.
- </p>
- <p>
- Whether the given point lies within this [name] or not.
- </p>
- <h3>[method:this copy]( [param:OBB obb] )</h3>
- <p>
- [page:OBB obb] — The [name] to copy.
- </p>
- <p>
- Copies the properties of the given [name] to this [name].
- </p>
- <h3>[method:Boolean equals]( [param:OBB obb] )</h3>
- <p>
- [page:OBB obb] — The [name] to test.
- </p>
- <p>
- Whether the given [name] is equal to this [name] or not.
- </p>
- <h3>[method:this fromBox3]( [param:Box3 box3] )</h3>
- <p>
- [page:Box3 box3] — An AABB.
- </p>
- <p>
- Defines an [name] based on the given AABB.
- </p>
- <h3>[method:Vector3 getSize]( [param:Vector3 size] )</h3>
- <p>
- [page:Vector3 size] — The result will be copied into this vector.
- </p>
- <p>
- Returns the size of this [name] into the given vector.
- </p>
- <h3>[method:Boolean intersectsBox3]( [param:Box3 box3] )</h3>
- <p>
- [page:Box3 box3] — The AABB to test.
- </p>
- <p>
- Whether the given AABB intersects this [name] or not.
- </p>
- <h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
- <p>
- [page:Sphere sphere] — The bounding sphere to test.
- </p>
- <p>
- Whether the given bounding sphere intersects this [name] or not.
- </p>
- <h3>[method:Boolean intersectsOBB]( [param:OBB obb], [param:Number epsilon] )</h3>
- <p>
- [page:OBB obb] — The OBB to test.<br />
- [page:Number epsilon] — An optional numeric value to counteract arithmetic errors. Default is `Number.EPSILON`.
- </p>
- <p>
- Whether the given [name] intersects this [name] or not.
- </p>
- <h3>[method:Boolean intersectsPlane]( [param:Plane plane] )</h3>
- <p>
- [page:Plane plane] — The plane to test.
- </p>
- <p>
- Whether the given plane intersects this [name] or not.
- </p>
- <h3>[method:Boolean intersectsRay]( [param:Ray ray] )</h3>
- <p>
- [page:Ray ray] — The ray to test.
- </p>
- <p>
- Whether the given ray intersects this [name] or not.
- </p>
- <h3>[method:Vector3 intersectRay]( [param:Ray ray], [param:Vector3 intersectionPoint] )</h3>
- <p>
- [page:Ray ray] — The ray to test.<br />
- [page:Vector3 intersectionPoint] — The result will be copied into this vector.
- </p>
- <p>
- Performs a Ray/OBB intersection test and stores the intersection point to the given 3D vector.
- If no intersection is detected, `null` is returned.
- </p>
- <h3>[method:this set]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
- <p>
- [page:Vector3 center] — The center of the [name].<br />
- [page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis.<br />
- [page:Matrix3 rotation] — The rotation of the [name].
- </p>
- <p>
- Defines the [name] for the given values.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/OBB.js examples/jsm/math/OBB.js]
- </p>
- </body>
- </html>
|