|
@@ -18,8 +18,11 @@
|
|
|
|
|
|
<h3>[name]( [page:Vector3 center], [page:Float radius] )</h3>
|
|
|
<div>
|
|
|
- center -- [page:Vector3] <br />
|
|
|
- radius -- [page:Float]
|
|
|
+ [page:Vector3 center] - center of the sphere. Default is a [page:Vector3] at (0, 0, 0). <br />
|
|
|
+ [page:Float radius] - radius of the sphere. Default is 0.<br /><br />
|
|
|
+
|
|
|
+ Creates a new [name].
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
|
|
@@ -27,129 +30,108 @@
|
|
|
|
|
|
|
|
|
<h3>[property:Vector3 center]</h3>
|
|
|
+ <div>A [page:Vector3] defining the center of the sphere. Default is (0, 0, 0).</div>
|
|
|
|
|
|
<h3>[property:Float radius]</h3>
|
|
|
-
|
|
|
+ <div>The radius of the sphere. Default is 0.</div>
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- <h3>[method:Sphere set]( [page:Vector3 center], [page:Float radius] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- center -- [page:Vector3] <br />
|
|
|
- radius -- [page:Float]
|
|
|
- </div>
|
|
|
+ <h3>[method:Sphere applyMatrix4]( [page:Matrix4 matrix] )</h3>
|
|
|
<div>
|
|
|
- Sets the center and radius.
|
|
|
- </div>
|
|
|
+ [page:Matrix4 matrix] - the [Page:Matrix4] to apply <br /><br />
|
|
|
|
|
|
- <h3>[method:Sphere applyMatrix4]( [page:Matrix4 matrix] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- matrix -- [page:Matrix4]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Transforms this sphere with the provided [page:Matrix4].
|
|
|
+ Transforms this sphere with the provided [page:Matrix4].
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Vector3 clampPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- point -- [page:Vector3] The point to clamp <br />
|
|
|
- optionalTarget -- [page:Vector3] The optional target point to return
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the closets point on the edge of the sphere.
|
|
|
- </div>
|
|
|
+ [page:Vector3 point] - [page:Vector3] The point to clamp.<br />
|
|
|
+ [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
|
|
|
|
|
|
- <h3>[method:Sphere translate]( [page:Vector3 offset] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- offset -- [page:Vector3]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Translate the sphere's center by the provided offset vector.
|
|
|
+ Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the
|
|
|
+ closets point on the edge of the sphere. Points already inside the sphere will not be affected.
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Sphere clone]()</h3>
|
|
|
- <div>
|
|
|
- Provides a new copy of the sphere.
|
|
|
- </div>
|
|
|
+ <div>Returns a new sphere with the same [page:.center center] and [page:.radius radius] as this one.</div>
|
|
|
|
|
|
- <h3>[method:Boolean equals]( [page:Sphere sphere] )</h3>
|
|
|
- <div>
|
|
|
- sphere -- [page:Sphere]
|
|
|
- </div>
|
|
|
+ <h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
|
|
|
<div>
|
|
|
- Checks to see if the two spheres' centers and radii are equal.
|
|
|
- </div>
|
|
|
+ [page:Vector3 point] - the [page:Vector3] to be checked<br /><br />
|
|
|
|
|
|
- <h3>[method:Sphere setFromPoints]( [page:Array points], [page:Vector3 optionalCenter] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- points -- [page:Array] of [page:Vector3] positions.<br />
|
|
|
- optionalCenter -- Optional [page:Vector3] position for the sphere's center.<br />
|
|
|
+ Checks to see if the sphere contains the provided [page:Vector3 point] inclusive of the
|
|
|
+ surface of the sphere.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Sphere copy]( [page:Sphere sphere] )</h3>
|
|
|
<div>
|
|
|
- Computes the minimum bounding sphere for *points*. If *optionalCenter* is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing *points* is calculated.
|
|
|
+ Copies the values of the passed sphere's [page:.center center] and [page:.radius radius]
|
|
|
+ properties to this sphere.
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
|
|
|
<div>
|
|
|
- point -- [page:Vector3]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.
|
|
|
+ Returns the closest distance from the boundary of the sphere to the [page:Vector3 point]. If the sphere contains the point,
|
|
|
+ the distance will be negative.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box3 getBoundingBox]( [page:Box optionalTarget] )</h3>
|
|
|
- <div>
|
|
|
- optionalTarget -- [page:Box]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns a bounding box for the sphere, optionally setting a provided box target.
|
|
|
- </div>
|
|
|
+ <h3>[method:Boolean empty]()</h3>
|
|
|
+ <div>Checks to see if the sphere is empty (the radius set to 0).</div>
|
|
|
|
|
|
- <h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
|
|
|
+ <h3>[method:Boolean equals]( [page:Sphere sphere] )</h3>
|
|
|
<div>
|
|
|
- point -- [page:Vector3]
|
|
|
+ Checks to see if the two spheres' centers and radii are equal.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Box3 getBoundingBox]( [page:Box3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Checks to see if the sphere contains the provided point inclusive of the edge of the sphere.
|
|
|
+ [page:Box3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Box3] will be created.<br /><br />
|
|
|
+
|
|
|
+ Returns a[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box] for the sphere.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Sphere copy]( [page:Sphere sphere] )</h3>
|
|
|
+ <h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
|
|
|
<div>
|
|
|
- sphere -- [page:Sphere] to copy
|
|
|
+ [page:Box3 box] - [page:Box3] to check for intersection against.<br /><br />
|
|
|
+
|
|
|
+ Determines whether or not this sphere intersects a given [page:Box3 box].
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Boolean intersectsPlane]( [page:Plane plane] )</h3>
|
|
|
<div>
|
|
|
- Copies the values of the passed sphere to this sphere.
|
|
|
+ [page:Plane plane] - Plane to check for intersection against.<br /><br />
|
|
|
+
|
|
|
+ Determines whether or not this sphere intersects a given [page:Plane plane].
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
|
|
|
<div>
|
|
|
- sphere -- [page:Sphere]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
+ [page:Sphere sphere] - Sphere to check for intersection against.<br /><br />
|
|
|
+
|
|
|
Checks to see if two spheres intersect.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Boolean intersectsBox]( [page:Box3 box] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- box -- Box to check for intersection against.
|
|
|
- </div>
|
|
|
+ <h3>[method:Sphere set]( [page:Vector3 center], [page:Float radius] )</h3>
|
|
|
<div>
|
|
|
- Determines whether or not this sphere intersects *box*.
|
|
|
- </div>
|
|
|
+ [page:Vector3 center] - center of the sphere.<br />
|
|
|
+ [page:Float radius] - radius of the sphere.<br /><br />
|
|
|
|
|
|
- <h3>[method:Boolean intersectsPlane]( [page:Plane plane] ) [page:Sphere this]</h3>
|
|
|
- <div>
|
|
|
- plane -- Plane to check for intersection against.
|
|
|
+ Sets the [page.center center] and [page.radius radius] properties of this sphere.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Sphere setFromPoints]( [page:Array points], [page:Vector3 optionalCenter] )</h3>
|
|
|
<div>
|
|
|
- Determines whether or not this sphere intersects *plane*.
|
|
|
+ [page:Array points] - an [page:Array] of [page:Vector3] positions.<br />
|
|
|
+ [page:Vector3 optionalCenter] - Optional [page:Vector3] position for the sphere's center.<br /><br />
|
|
|
+
|
|
|
+ Computes the minimum bounding sphere for an array of [page:Array points]. If [page:Vector3 optionalCenter]is given,
|
|
|
+ it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing
|
|
|
+ [page:Array points] is calculated.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Boolean empty]()</h3>
|
|
|
- <div>
|
|
|
- Checks to see if the sphere is empty (the radius set to 0).
|
|
|
+ <h3>[method:Sphere translate]( [page:Vector3 offset] )</h3>
|
|
|
+ Translate the sphere's center by the provided offset [page:Vector3].
|
|
|
</div>
|
|
|
|
|
|
<h2>Source</h2>
|