| 869 | //------------------------------------------------------------------------------ |
| 870 | |
| 871 | static int CartesianToSpherical( |
| 872 | double x, double y, double z, double* rho, double* phi, double* theta) |
| 873 | { |
| 874 | double trho, ttheta, tphi; |
| 875 | |
| 876 | trho = sqrt((x * x) + (y * y) + (z * z)); |
| 877 | ttheta = atan2(y, x); |
| 878 | tphi = acos(z / (trho)); |
| 879 | if (vtkMath::IsNan(trho) || vtkMath::IsNan(ttheta) || vtkMath::IsNan(tphi)) |
| 880 | { |
| 881 | return -1; |
| 882 | } |
| 883 | *rho = trho; |
| 884 | *theta = ttheta; |
| 885 | *phi = tphi; |
| 886 | return 0; |
| 887 | } |
| 888 | |
| 889 | //------------------------------------------------------------------------------ |
| 890 | // Function to convert spherical coordinates to cartesian, for use in |
no test coverage detected