30 static const double atorad = 2.0 * M_PI / 360.0 ;
36 x = len * cos (azi * atorad) * cos (ele * atorad);
37 y = len * sin (azi * atorad) * cos (ele * atorad);
38 z = len * sin (ele * atorad);
47 double rho, theta, phi;
49 rho = sqrt (x*x + y*y + z*z);
58 azimuth = 180.0 - (180.0 * (theta / M_PI));
60 azimuth = 180.0 * (theta / M_PI);
64 elevation = 180.0 - (180.0 * (phi / M_PI));
66 elevation = 180.0 * (phi / M_PI);
73 const double atorad = 2.0 * M_PI / 360.0;
74 double atan_y_per_x, atan_x_pl_y_per_z;
78 atan_y_per_x = M_PI / 2;
80 atan_y_per_x = atan2 (y,x);
85 azimuth = 180.0 + (atan_y_per_x / (M_PI/180.0) + 180.0);
88 azimuth = atan_y_per_x / atorad;
91 distance = sqrt (x*x + y*y);
94 atan_x_pl_y_per_z = 0.0;
96 atan_x_pl_y_per_z = atan2 (z,distance);
99 if (distance == 0.0) {
101 atan_x_pl_y_per_z = -M_PI/2.0;
102 }
else if (z > 0.0) {
103 atan_x_pl_y_per_z = M_PI/2.0;
107 elevation = atan_x_pl_y_per_z / atorad;
LIBPBD_API void cartesian_to_spherical(double x, double y, double z, double &azi, double &ele, double &len)
LIBPBD_API void spherical_to_cartesian(double azi, double ele, double len, double &x, double &y, double &z)
LIBARDOUR_API PBD::PropertyDescriptor< framecnt_t > length