optimize deg2rad
This commit is contained in:
parent
1b298b9cac
commit
e952d95b95
|
|
@ -24,11 +24,11 @@
|
|||
#include "mathNumbers.h"
|
||||
|
||||
BEGIN_PUBLISH
|
||||
INLINE_LINMATH double deg_2_rad( double f ) { return f * (MathNumbers::pi / 180.0); }
|
||||
INLINE_LINMATH double rad_2_deg( double f ) { return f * (180.0 / MathNumbers::pi); }
|
||||
INLINE_LINMATH double deg_2_rad( double f ) { return f * MathNumbers::deg_2_rad; }
|
||||
INLINE_LINMATH double rad_2_deg( double f ) { return f * MathNumbers::rad_2_deg; }
|
||||
|
||||
INLINE_LINMATH float deg_2_rad( float f ) { return f * (MathNumbers::pi_f / 180.0f); }
|
||||
INLINE_LINMATH float rad_2_deg( float f ) { return f * (180.0f / MathNumbers::pi_f); }
|
||||
INLINE_LINMATH float deg_2_rad( float f ) { return f * MathNumbers::deg_2_rad_f; }
|
||||
INLINE_LINMATH float rad_2_deg( float f ) { return f * MathNumbers::rad_2_deg_f; }
|
||||
END_PUBLISH
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@
|
|||
|
||||
const double MathNumbers::pi = 4.0 * atan(1.0);
|
||||
const double MathNumbers::ln2 = log(2.0);
|
||||
const double MathNumbers::rad_2_deg = 180.0 / MathNumbers::pi;
|
||||
const double MathNumbers::deg_2_rad = MathNumbers::pi / 180.0;
|
||||
|
||||
const float MathNumbers::pi_f = 4.0 * atan(1.0);
|
||||
const float MathNumbers::ln2_f = log(2.0);
|
||||
const float MathNumbers::rad_2_deg_f = 180.0 / MathNumbers::pi;
|
||||
const float MathNumbers::deg_2_rad_f = MathNumbers::pi / 180.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,14 @@
|
|||
class EXPCL_PANDA MathNumbers {
|
||||
PUBLISHED:
|
||||
static const float pi_f;
|
||||
static const float rad_2_deg_f;
|
||||
static const float deg_2_rad_f;
|
||||
static const float ln2_f;
|
||||
|
||||
static const double pi;
|
||||
static const double ln2;
|
||||
static const double rad_2_deg;
|
||||
static const double deg_2_rad;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue