Class: Sphere

Sphere(radius, center)

A sphere represented by its center and its radius.

Constructor

new Sphere(radius, center)

Creates a new sphere.
Parameters:
Name Type Default Description
radius Number 0 The radius of the sphere.
center Vector3 The center of the sphere. The default is (0, 0, 0).
Source:

Members

diameter

Gets the diameter of the sphere.
Source:

diameter

Sets the diameter of the sphere.
Source:

Methods

clone() → {Sphere}

Creates a clone of the sphere.
Source:
Returns:
The cloned sphere.
Type
Sphere

copy(sphere) → {Sphere}

Copies the radius and the center of another sphere.
Parameters:
Name Type Description
sphere Sphere The sphere to copy.
Source:
Returns:
The sphere.
Type
Sphere

equals(sphere) → {Boolean}

Compares the radius and the center to another sphere.
Parameters:
Name Type Description
sphere Sphere sphere to compare to.
Source:
Returns:
A value indicating whether the radius and the center are equal.
Type
Boolean

setCenter(center)

Sets the center of the sphere to the same values of a vector.
Parameters:
Name Type Description
center Vector3 The vector containing the values to set.
Source:

setRadius(radius) → {Sphere}

Sets the radius of the sphere.
Parameters:
Name Type Description
radius Number The radius of the sphere.
Source:
Returns:
The sphere.
Type
Sphere

surfaceArea() → {Number}

Calculates the surface area of the sphere.
Source:
Returns:
The surface area of the sphere.
Type
Number

volume() → {Number}

Calculates the volume of the sphere.
Source:
Returns:
The volume of the sphere.
Type
Number