Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
#ifndef tools_mathf
|
||||
#define tools_mathf
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace tools {
|
||||
|
||||
//have : static const fpi = (float)3.1415926535897931160E0; ???
|
||||
@@ -14,6 +12,33 @@ inline float fpi() {return (float)3.1415926535897931160E0;}
|
||||
inline float ftwo_pi() {return (float)6.2831853071795862320E0;}
|
||||
inline float fhalf_pi() {return (float)1.5707963267948965580E0;}
|
||||
|
||||
//inline float fdeg2rad() {return fpi()/180.0f;} //0.0174f
|
||||
//inline float frad2deg() {return 180.0f/fpi();}
|
||||
|
||||
inline float fdeg2rad() {
|
||||
static const float s_v = fpi()/180.0f; //0.0174f
|
||||
return s_v;
|
||||
}
|
||||
inline float frad2deg() {
|
||||
static const float s_v = 180.0f/fpi();
|
||||
return s_v;
|
||||
}
|
||||
|
||||
inline int fround(float a_x) {
|
||||
// From CoinGL/src/base/SbViewportRegion.cpp.
|
||||
if (a_x == (float) (int(a_x))) return int(a_x);
|
||||
else return (a_x>0.0f) ? int(a_x+0.5f) : -int(0.5f-a_x);
|
||||
}
|
||||
|
||||
inline float fstep(float a_x) {return a_x<0.0f?0.0f:1.0f;}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace tools {
|
||||
|
||||
inline float fcos(float x) {return (float)::cos(double(x));}
|
||||
inline float fsin(float x) {return (float)::sin(double(x));}
|
||||
inline float facos(float x) {return (float)::acos(double(x));}
|
||||
@@ -27,19 +52,13 @@ inline float fexp(float x) {return (float)::exp(double(x));}
|
||||
inline float flog(float x) {return (float)::log(double(x));}
|
||||
inline float flog10(float x) {return (float)::log10(double(x));}
|
||||
inline float ffloor(float x) {return (float)::floor(double(x));}
|
||||
inline float ffabs(float x) {return (float)::fabs(double(x));}
|
||||
inline float fceil(float x) {return (float)::ceil(double(x));}
|
||||
|
||||
inline float fdeg2rad() {return fpi()/180.0f;} //0.0174f
|
||||
inline float frad2deg() {return 180.0f/fpi();}
|
||||
inline float fcosh(float x) {return (float)::cosh(double(x));}
|
||||
inline float fsinh(float x) {return (float)::sinh(double(x));}
|
||||
|
||||
inline int fround(float a_x) {
|
||||
// From CoinGL/src/base/SbViewportRegion.cpp.
|
||||
if (a_x == (float) (int(a_x))) return int(a_x);
|
||||
else return (a_x>0.0f) ? int(a_x+0.5f) : -int(0.5f-a_x);
|
||||
}
|
||||
inline float ffabs(float x) {return (float)::fabs(double(x));}
|
||||
|
||||
inline float fstep(float a_x) {return a_x<0.0f?0.0f:1.0f;}
|
||||
inline float ffabsc(const float& x) {return (float)::fabs(double(x));}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user