static public Spherical CartesianToSpherical(Vector3 cartesian) { Spherical spherical; spherical = new Spherical(); spherical.Radius = cartesian.magnitude; spherical.Theta = Mathf.Atan2(cartesian.y, cartesian.x); spherical.Phi = Mathf.Acos(cartesian.z / spherical.Radius); return(spherical); }
static public Vector3 SphericalToCartesian(Spherical spherical) { return(SphericalToCartesian(spherical.Radius, spherical.Theta, spherical.Phi)); }