You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
4.7 KiB

2 years ago
<!DOCTYPE html>
<html lang="zh">
<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>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 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>