add Geo but not tested yet:(

git-svn-id: svn://db.shs.com.ru/pip@144 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-07-28 09:01:02 +00:00
parent 4492ff605c
commit 166239e6ec
7 changed files with 862 additions and 3 deletions

View File

@@ -62,10 +62,10 @@
# define M_1_SQRT3 0.57735026918962584208
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846
# define M_PI 3.141592653589793238462643383280
#endif
#ifndef M_2PI
# define M_2PI 6.28318530717958647692
# define M_2PI 6.283185307179586476925286766559
#endif
#ifndef M_PI_3
# define M_PI_3 1.04719755119659774615
@@ -79,12 +79,21 @@
#ifndef M_PI_180
# define M_PI_180 1.74532925199432957692e-2
#endif
#ifndef M_SQRT_PI
# define M_SQRT_PI 1.772453850905516027298167483341
#endif
#ifndef M_E
# define M_E 2.7182818284590452353602874713527
#endif
#ifndef M_LIGHT_SPEED
# define M_LIGHT_SPEED 2.99792458e+8
#endif
#ifndef M_RELATIVE_CONST
# define M_RELATIVE_CONST -4.442807633e-10;
#endif
#ifndef M_GRAVITY_CONST
# define M_GRAVITY_CONST 398600.4418e9;
#endif
using std::complex;

View File

@@ -58,9 +58,12 @@ public:
Type angleSin(const _CVector & v) const {Type tv = angleCos(v); return sqrt(Type(1) - tv * tv);}
Type angleRad(const _CVector & v) const {return acos(angleCos(v));}
Type angleDeg(const _CVector & v) const {return toDeg(acos(angleCos(v)));}
Type angleElevation(const _CVector & v) const {_CVector z = v - *this; double c = z.angleCos(*this); return 90.0 - acos(c) * rad2deg;}
_CVector projection(const _CVector & v) {Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
_CVector & normalize() {Type tv = length(); if (tv == Type(1)) return *this; if (piAbs<Type>(tv) <= Type(1E-100)) {fill(Type(0)); return *this;} PIMV_FOR(i, 0) c[i] /= tv; return *this;}
_CVector normalized() {_CVector tv(*this); tv.normalize(); return tv;}
_CVector cross(const _CVector & v) {return (*this) * v;}
Type dot(const _CVector & v) const {return (*this) ^ v;}
bool isNull() const {PIMV_FOR(i, 0) if (c[i] != Type(0)) return false; return true;}
bool isOrtho(const _CVector & v) const {return ((*this) ^ v) == Type(0);}