toDeg and toRad
This commit is contained in:
@@ -109,8 +109,12 @@ PIP_EXPORT double piYn(int n, const double & v);
|
|||||||
|
|
||||||
template <typename T> inline constexpr T toDb(T val) {return T(10.) * std::log10(val);}
|
template <typename T> inline constexpr T toDb(T val) {return T(10.) * std::log10(val);}
|
||||||
template <typename T> inline constexpr T fromDb(T val) {return std::pow(T(10.), val / T(10.));}
|
template <typename T> inline constexpr T fromDb(T val) {return std::pow(T(10.), val / T(10.));}
|
||||||
template <typename T> inline constexpr T toRad(T deg) {return deg * T(M_PI_180);}
|
inline constexpr float toRad(float deg) {return deg * M_PI_180;}
|
||||||
template <typename T> inline constexpr T toDeg(T rad) {return rad * T(M_180_PI);}
|
inline constexpr double toRad(double deg) {return deg * M_PI_180;}
|
||||||
|
inline constexpr long double toRad(long double deg) {return deg * M_PI_180;}
|
||||||
|
inline constexpr float toDeg(float rad) {return rad * M_180_PI;}
|
||||||
|
inline constexpr double toDeg(double rad) {return rad * M_180_PI;}
|
||||||
|
inline constexpr long double toDeg(long double rad) {return rad * M_180_PI;}
|
||||||
template <typename T> inline constexpr T sqr(const T & v) {return v * v;}
|
template <typename T> inline constexpr T sqr(const T & v) {return v * v;}
|
||||||
|
|
||||||
// [-1 ; 1]
|
// [-1 ; 1]
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
return std::sqrt(Type(1) - tv * tv);
|
return std::sqrt(Type(1) - tv * tv);
|
||||||
}
|
}
|
||||||
Type angleRad(const _CVector & v) const {return std::acos(angleCos(v));}
|
Type angleRad(const _CVector & v) const {return std::acos(angleCos(v));}
|
||||||
Type angleDeg(const _CVector & v) const {return toDeg<Type>(angleRad(v));}
|
Type angleDeg(const _CVector & v) const {return toDeg(angleRad(v));}
|
||||||
Type angleElevation(const _CVector & v) const {return 90.0 - angleDeg(v - *this);}
|
Type angleElevation(const _CVector & v) const {return 90.0 - angleDeg(v - *this);}
|
||||||
_CVector projection(const _CVector & v) {
|
_CVector projection(const _CVector & v) {
|
||||||
Type tv = v.length();
|
Type tv = v.length();
|
||||||
|
|||||||
Reference in New Issue
Block a user