Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 static public Vector3 SphericalToCartesian(Spherical spherical)
 {
     return(SphericalToCartesian(spherical.Radius, spherical.Theta, spherical.Phi));
 }