MathFuncs.h 1.3 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. extern void mathSanityChecks(); ///< Used to test the compiler
  9. extern void sinCos(float rad, float& sin_, float& cos_); ///< A fast func that given the angle in rads it returns the sin and cos
  10. extern float invSqrt(float f); ///< Inverted square root
  11. extern float sqrt(float f); ///< Square root
  12. extern float toRad(float degrees);
  13. extern float toDegrees(float rad);
  14. extern float sin(float rad);
  15. extern float cos(float rad);
  16. extern bool isZero(float f); ///< The proper way to test if a float is zero
  17. /**
  18. * mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
  19. */
  20. extern 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. * mat4(t0,r0, 1.0)*mat4(t1,r1, 1.0) == mat4(tf,rf,sf)
  25. */
  26. extern 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