## File: vec3.C

package info (click to toggle)
flying 6.20-6
 `123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110` ``````#ifndef _global_h # include "global.h" #endif #ifndef _vec3_h # include "vec3.h" #endif Vec3 Vec3Zero( RealZero, RealZero, RealZero ); #if (Vec3IsVector) Vec3::Vec3( const Real &l, const Real &b ) : Vector(3,0.0,0.0,0.0) { Real hr = sin(b/180.0*M_PI); // Radius am 'Breitengrad' b; data[0] = hr*cos(l/180.0*M_PI); data[1] = hr*sin(l/180.0*M_PI); data[2] = cos(b/180.0*M_PI); // H�he, bestimmt durch Breitengrad } #else Vec3::Vec3( const Real &l, const Real &b ) { Real hr = sin(b/180.0*M_PI); // Radius am 'Breitengrad' b; x_val = hr*cos(l/180.0*M_PI); y_val = hr*sin(l/180.0*M_PI); z_val = cos(b/180.0*M_PI); // H�he, bestimmt durch Breitengrad norm = RealZero; } #endif // // Berechnung des Winkels zwischen 2 Vec2en // Real Vec3::AngleRadTo( Vec3 &d ) { Real cos_phi = (*this)*d/(Norm()*d.Norm()); return acos( cos_phi ); } Real Vec3::AngleRad( const Real &dx, const Real &dy ) { Real erg; #if (0) static FunTab *TAN=0; if (!TAN) TAN = new FunTab( tan, -M_PI_2, M_PI_2, 64 ); #endif if (dx) erg = atan( dy/dx ); else erg = (dy>=RealZero)?M_PI_2:3*M_PI_2; if (dx