9 #ifndef Versor_vsr_coord_h
10 #define Versor_vsr_coord_h
19 namespace vsr {
namespace cga {
24 Sph(
double t,
double p,
double r) : theta(t), phi(p), rad(r) {}
25 double theta, phi, rad;
27 void print() { printf(
"az: %f\telev: %f\tdist: %f", theta, phi, rad); }
36 inline Vec sph2vec(
double theta,
double phi){
37 Rot r = Gen::rot(theta/2.0, phi/2.0);
41 inline Sph vec2sph(
const Vec& tv){
43 return Sph( atan2(tv[2],tv[0]) , acos(-tv[1]/r) - PIOVERTWO, r);
47 inline Sph sph2deg(
const Sph& cs ){
48 double a = ( 180. * ( ( cs.theta / PI ) + 1. ) ) - 90.;
49 if (a < 0 ) a = 360 + a;
50 double e = 90. * cs.phi / PIOVERTWO;
52 return Sph( a, e, r );
56 inline Sph vec2deg(
const T& v ){
57 return sph2deg( vec2sph(v) );
Common Operations Specific to CGA3D.
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
the versor library namespace
Definition: vsr_algebra.h:29
Definition: vsr_coord.h:23
NSph< 5 > Sph
Sphere
Definition: vsr_cga3D_types.h:75