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.
 
 
 
 
 

161 lines
5.4 KiB

<!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">A sphere defined by a center and radius.</p>
<h2>Constructor</h2>
<h3>[name]( [param:Vector3 center], [param:Float radius] )</h3>
<p>
[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 -1.<br /><br />
Creates a new [name].
</p>
<h2>Properties</h2>
<h3>[property:Vector3 center]</h3>
<p>A [page:Vector3] defining the center of the sphere. Default is `(0, 0, 0)`.</p>
<h3>[property:Float radius]</h3>
<p>The radius of the sphere. Default is -1.</p>
<h2>Methods</h2>
<h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
<p>
[page:Matrix4 matrix] - the [Page:Matrix4] to apply <br /><br />
Transforms this sphere with the provided [page:Matrix4].
</p>
<h3>[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )</h3>
<p>
[page:Vector3 point] - [page:Vector3] The point to clamp.<br />
[page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
Clamps a point within the sphere. If the point is outside the sphere, it will clamp it to the
closest point on the edge of the sphere. Points already inside the sphere will not be affected.
</p>
<h3>[method:Sphere clone]()</h3>
<p>Returns a new sphere with the same [page:.center center] and [page:.radius radius] as this one.</p>
<h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
<p>
[page:Vector3 point] - the [page:Vector3] to be checked<br /><br />
Checks to see if the sphere contains the provided [page:Vector3 point] inclusive of the
surface of the sphere.
</p>
<h3>[method:this copy]( [param:Sphere sphere] )</h3>
<p>
Copies the values of the passed sphere's [page:.center center] and [page:.radius radius]
properties to this sphere.
</p>
<h3>[method:Float distanceToPoint]( [param:Vector3 point] )</h3>
<p>
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.
</p>
<h3>[method:this expandByPoint]( [param:Vector3 point] )</h3>
<p>
[page:Vector3 point] - [page:Vector3] that should be included in the sphere.<br /><br />
Expands the boundaries of this sphere to include [page:Vector3 point].
</p>
<h3>[method:Boolean isEmpty]()</h3>
<p>
Checks to see if the sphere is empty (the radius set to a negative number).</br>
Spheres with a radius of 0 contain only their center point and are not considered to be empty.
</p>
<h3>[method:this makeEmpty]()</h3>
<p>Makes the sphere empty by setting [page:.center center] to (0, 0, 0) and [page:.radius radius] to -1.</p>
<h3>[method:Boolean equals]( [param:Sphere sphere] )</h3>
<p>
Checks to see if the two spheres' centers and radii are equal.
</p>
<h3>[method:Box3 getBoundingBox]( [param:Box3 target] )</h3>
<p>
[page:Box3 target] — the result will be copied into this Box3.<br /><br />
Returns a[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box] for the sphere.
</p>
<h3>[method:Boolean intersectsBox]( [param:Box3 box] )</h3>
<p>
[page:Box3 box] - [page:Box3] to check for intersection against.<br /><br />
Determines whether or not this sphere intersects a given [page:Box3 box].
</p>
<h3>[method:Boolean intersectsPlane]( [param:Plane plane] )</h3>
<p>
[page:Plane plane] - Plane to check for intersection against.<br /><br />
Determines whether or not this sphere intersects a given [page:Plane plane].
</p>
<h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
<p>
[page:Sphere sphere] - Sphere to check for intersection against.<br /><br />
Checks to see if two spheres intersect.
</p>
<h3>[method:this set]( [param:Vector3 center], [param:Float radius] )</h3>
<p>
[page:Vector3 center] - center of the sphere.<br />
[page:Float radius] - radius of the sphere.<br /><br />
Sets the [page:.center center] and [page:.radius radius] properties of this sphere.<br>
Please note that this method only copies the values from the given center.
</p>
<h3>[method:this setFromPoints]( [param:Array points], [param:Vector3 optionalCenter] )</h3>
<p>
[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.
</p>
<h3>[method:this translate]( [param:Vector3 offset] )</h3>
<p>
Translate the sphere's center by the provided offset [page:Vector3].
</p>
<h3>[method:this union]( [param:Sphere sphere] )</h3>
<p>
[page:Sphere sphere] - Bounding sphere that will be unioned with this sphere.<br /><br />
Expands this sphere to enclose both the original sphere and the given sphere.
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</p>
</body>
</html>