Funcs.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef MATH_FUNCS_H
  2. #define MATH_FUNCS_H
  3. #include "Common.h"
  4. namespace M {
  5. const float PI = 3.14159265358979323846;
  6. const float EPSILON = 1.0e-6;
  7. extern void sinCos(float rad, float& sin_, float& cos_); ///< A fast func that given the angle in rads it returns the sin and cos
  8. extern float sqrt(float f); ///< Square root
  9. extern float toRad(float degrees);
  10. extern float toDegrees(float rad);
  11. extern float sin(float rad);
  12. extern float cos(float rad);
  13. extern bool isZero(float f); ///< The proper way to test if a float is zero
  14. /// mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
  15. extern void combineTransformations(const Vec3& t0, const Mat3& r0, float s0, // in 0
  16. const Vec3& t1, const Mat3& r1, float s1, // in 1
  17. Vec3& tf, Mat3& rf, float& sf); // out
  18. /// mat4(t0,r0, 1.0)*mat4(t1,r1, 1.0) == mat4(tf,rf,sf)
  19. extern void combineTransformations(const Vec3& t0, const Mat3& r0, // in 0
  20. const Vec3& t1, const Mat3& r1, // in 1
  21. Vec3& tf, Mat3& rf); // out
  22. } // end namespace
  23. #include "Funcs.inl.h"
  24. #endif