fromSpherical method

Vector3 fromSpherical(
  1. double radius,
  2. double phi,
  3. double theta
)

Sets the components of this 3D vector from a spherical coordinate.

Implementation

Vector3 fromSpherical(double radius, double phi, double theta ) {
	final sinPhiRadius = math.sin( phi ) * radius;

	x = sinPhiRadius * math.sin( theta );
	y = math.cos( phi ) * radius;
	z = sinPhiRadius * math.cos( theta );

	return this;
}