MathFuncs.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _MATHFUNCS_H_
  2. #define _MATHFUNCS_H_
  3. #include "Common.h"
  4. #include "MathForwardDecls.h"
  5. namespace M {
  6. const float PI = 3.14159265358979323846;
  7. const float EPSILON = 1.0e-6;
  8. void mathSanityChecks();
  9. void sinCos( float rad, float& sin_, float& cos_ );
  10. float invSqrt( float f );
  11. float sqrt( float f );
  12. float toRad( float degrees );
  13. float toDegrees( float rad );
  14. float sin( float rad );
  15. float cos( float rad );
  16. bool isZero( float f );
  17. /**
  18. * @brief mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
  19. */
  20. void combineTransformations( const Vec3& t0, const Mat3& r0, float s0, // in 0
  21. const Vec3& t1, const Mat3& r1, float s1, // in 1
  22. Vec3& tf, Mat3& rf, float& sf ); // out
  23. /**
  24. * @brief mat4(t0,r0,1.0)*mat4(t1,r1,1.0) == mat4(tf,rf,sf)
  25. */
  26. void combineTransformations( const Vec3& t0, const Mat3& r0, // in 0
  27. const Vec3& t1, const Mat3& r1, // in 1
  28. Vec3& tf, Mat3& rf); // out
  29. } // end namespace
  30. #include "MathFuncs.inl.h"
  31. #endif