Constructor
new Sphere(centeropt, radiusopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
center | t3d. | <optional> | Vector3(0, 0, 0) | center of the sphere. |
radius | Number | <optional> | -1 | radius of the sphere. |
Methods
applyMatrix4(matrix) → {t3d.Matrix4}
Transforms this sphere with the provided Matrix4.
Parameters:
Name | Type | Description |
---|---|---|
matrix | t3d. | the Matrix4 to apply |
Returns:
- Type:
- t3d.
Matrix4
clone() → {t3d.Sphere}
Returns a new sphere with the same center and radius as this one.
Returns:
- Type:
- t3d.
Sphere
containsPoint(point) → {Boolean}
Checks to see if the sphere contains the provided point inclusive of the surface of the sphere.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | The point to check for containment. |
Returns:
- Type:
- Boolean
copy(sphere) → {t3d.Sphere}
Copies the values of the passed sphere's center and radius properties to this sphere.
Parameters:
Name | Type | Description |
---|---|---|
sphere | t3d. |
Returns:
- Type:
- t3d.
Sphere
distanceToPoint(point) → {Number}
Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | The point to calculate the distance to. |
Returns:
- Type:
- Number
expandByPoint(point) → {t3d.Sphere}
Expands the boundaries of this sphere to include point.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | The vector3 that should be included in the sphere. |
Returns:
- Type:
- t3d.
Sphere
getBoundingBox(target) → {t3d.Box3}
Returns aMinimum Bounding Box for the sphere.
Parameters:
Name | Type | Description |
---|---|---|
target | t3d. | — the result will be copied into this Box3. |
Returns:
- Type:
- t3d.
Box3
isEmpty() → {Boolean}
Checks to see if the sphere is empty (the radius set to a negative number). Spheres with a radius of 0 contain only their center point and are not considered to be empty.
Returns:
- Type:
- Boolean
makeEmpty() → {t3d.Sphere}
Makes the sphere empty by setting center to (0, 0, 0) and radius to -1.
Returns:
- Type:
- t3d.
Sphere
set(center, radius) → {t3d.Sphere}
Sets the center and radius properties of this sphere.
Parameters:
Name | Type | Description |
---|---|---|
center | t3d. | center of the sphere. |
radius | Number | radius of the sphere. |
Returns:
- Type:
- t3d.
Sphere
setFromArray(array, gapopt, offsetopt) → {t3d.Sphere}
Computes the minimum bounding sphere for an array of points.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array | Array.<Number> | an Array of Vector3 positions. | ||
gap | Number | <optional> | 3 | array gap. |
offset | Number | <optional> | 0 | array offset. |
Returns:
- Type:
- t3d.
Sphere
setFromPoints(points, optionalCenteropt) → {t3d.Sphere}
Computes the minimum bounding sphere for an array of points. If optionalCenteris given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing points is calculated.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
points | Array.<t3d.Vector3> | an Array of Vector3 positions. | |
optionalCenter | t3d. | <optional> | the center of the sphere. |
Returns:
- Type:
- t3d.
Sphere