Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_math.h
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_math.h
r4271 r8127 24 24 #endif 25 25 26 #include <qpoint.h>27 26 #include <qmath.h> 28 27 #include "qwt_global.h" 29 28 30 #ifndef LOG10_2 31 #define LOG10_2 0.30102999566398119802 /* log10(2) */ 32 #endif 33 34 #ifndef LOG10_3 35 #define LOG10_3 0.47712125471966243540 /* log10(3) */ 36 #endif 37 38 #ifndef LOG10_5 39 #define LOG10_5 0.69897000433601885749 /* log10(5) */ 40 #endif 41 42 #ifndef M_2PI 43 #define M_2PI 6.28318530717958623200 /* 2 pi */ 29 #ifndef M_PI_2 30 // For Qt <= 4.8.4 M_PI_2 is not known by MinGW-w64 31 // when compiling with -std=c++11 32 #define M_PI_2 (1.57079632679489661923) 44 33 #endif 45 34 46 35 #ifndef LOG_MIN 47 //! Mini num value for logarithmic scales36 //! Minimum value for logarithmic scales 48 37 #define LOG_MIN 1.0e-100 49 38 #endif … … 54 43 #endif 55 44 56 #ifndef M_E57 #define M_E 2.7182818284590452354 /* e */58 #endif59 60 #ifndef M_LOG2E61 #define M_LOG2E 1.4426950408889634074 /* log_2 e */62 #endif63 64 #ifndef M_LOG10E65 #define M_LOG10E 0.43429448190325182765 /* log_10 e */66 #endif67 68 #ifndef M_LN269 #define M_LN2 0.69314718055994530942 /* log_e 2 */70 #endif71 72 #ifndef M_LN1073 #define M_LN10 2.30258509299404568402 /* log_e 10 */74 #endif75 76 #ifndef M_PI77 #define M_PI 3.14159265358979323846 /* pi */78 #endif79 80 #ifndef M_PI_281 #define M_PI_2 1.57079632679489661923 /* pi/2 */82 #endif83 84 #ifndef M_PI_485 #define M_PI_4 0.78539816339744830962 /* pi/4 */86 #endif87 88 #ifndef M_1_PI89 #define M_1_PI 0.31830988618379067154 /* 1/pi */90 #endif91 92 #ifndef M_2_PI93 #define M_2_PI 0.63661977236758134308 /* 2/pi */94 #endif95 96 #ifndef M_2_SQRTPI97 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */98 #endif99 100 #ifndef M_SQRT2101 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */102 #endif103 104 #ifndef M_SQRT1_2105 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */106 #endif107 108 45 QWT_EXPORT double qwtGetMin( const double *array, int size ); 109 46 QWT_EXPORT double qwtGetMax( const double *array, int size ); 47 48 QWT_EXPORT double qwtNormalizeRadians( double radians ); 49 QWT_EXPORT double qwtNormalizeDegrees( double degrees ); 110 50 111 51 /*! … … 162 102 } 163 103 164 //! Like qRound, but without converting the result to an int 165 inline double qwtRoundF(double d) 166 { 167 return ::floor( d + 0.5 ); 104 //! Approximation of arc tangent ( error below 0,005 radians ) 105 inline double qwtFastAtan( double x ) 106 { 107 if ( x < -1.0 ) 108 return -M_PI_2 - x / ( x * x + 0.28 ); 109 110 if ( x > 1.0 ) 111 return M_PI_2 - x / ( x * x + 0.28 ); 112 113 return x / ( 1.0 + x * x * 0.28 ); 168 114 } 169 115 170 //! Like qFloor, but without converting the result to an int 171 inline double qwtFloorF(double d) 172 { 173 return ::floor( d ); 116 //! Approximation of arc tangent ( error below 0,005 radians ) 117 inline double qwtFastAtan2( double y, double x ) 118 { 119 if ( x > 0 ) 120 return qwtFastAtan( y / x ); 121 122 if ( x < 0 ) 123 { 124 const double d = qwtFastAtan( y / x ); 125 return ( y >= 0 ) ? d + M_PI : d - M_PI; 126 } 127 128 if ( y < 0.0 ) 129 return -M_PI_2; 130 131 if ( y > 0.0 ) 132 return M_PI_2; 133 134 return 0.0; 174 135 } 175 136 176 //! Like qCeil, but without converting the result to an int 177 inline double qwtCeilF(double d) 178 { 179 return ::ceil( d ); 137 //! Translate degrees into radians 138 inline double qwtRadians( double degrees ) 139 { 140 return degrees * M_PI / 180.0; 141 } 142 143 //! Translate radians into degrees 144 inline double qwtDegrees( double degrees ) 145 { 146 return degrees * 180.0 / M_PI; 180 147 } 181 148
Note:
See TracChangeset
for help on using the changeset viewer.