setFromCartesianCoords method

Spherical setFromCartesianCoords(
  1. num x,
  2. num y,
  3. num z
)

Implementation

Spherical setFromCartesianCoords(num x, num y, num z) {
  radius = Math.sqrt(x * x + y * y + z * z);

  if (radius == 0) {
    theta = 0;
    phi = 0;
  } else {
    theta = Math.atan2(x, z);
    phi = Math.acos(MathUtils.clamp(y / radius, -1, 1));
  }

  return this;
}