diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-24 18:55:33 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-24 18:55:33 +0000 |
commit | 5ad82b1e6d3a1b473137ab8b5f15ecf190eed51f (patch) | |
tree | 667407740e60ca0d5aed23660d726de56c868408 /libs/pbd/cartesian.cc | |
parent | 0c5c1aafd06f24442f31f87de1fd1f51d6ce9291 (diff) |
switch cartesian/spherical function names and make them use length. still a tweak needed here
git-svn-id: svn://localhost/ardour2/branches/3.0@8952 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/cartesian.cc')
-rw-r--r-- | libs/pbd/cartesian.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/pbd/cartesian.cc b/libs/pbd/cartesian.cc index 196023f606..d15f9a3c27 100644 --- a/libs/pbd/cartesian.cc +++ b/libs/pbd/cartesian.cc @@ -24,19 +24,23 @@ using namespace std; void -PBD::azi_ele_to_cart (double azi, double ele, double& x, double& y, double& z) +PBD::spherical_to_cartesian (double azi, double ele, double len, double& x, double& y, double& z) { /* convert from cylindrical coordinates in degrees to cartesian */ static const double atorad = 2.0 * M_PI / 360.0 ; + + if (len == 0.0) { + len = 1.0; + } - x = cos (azi * atorad) * cos (ele * atorad); - y = sin (azi * atorad) * cos (ele * atorad); - z = sin (ele * atorad); + x = len * cos (azi * atorad) * cos (ele * atorad); + y = len * sin (azi * atorad) * cos (ele * atorad); + z = len * sin (ele * atorad); } void -PBD::cart_to_azi_ele (double x, double y, double z, double& azimuth, double& elevation) +PBD::cartesian_to_spherical (double x, double y, double z, double& azimuth, double& elevation, double& length) { #if 1 /* converts cartesian coordinates to cylindrical in degrees*/ @@ -62,6 +66,8 @@ PBD::cart_to_azi_ele (double x, double y, double z, double& azimuth, double& ele } else { elevation = 180.0 * (phi / M_PI); } + + length = rho; #else /* converts cartesian coordinates to cylindrical in degrees*/ |