EPS.h 650 B

123456789101112131415161718192021222324252627
  1. #ifndef IGL_EPS_H
  2. #define IGL_EPS_H
  3. // Define a standard value for double epsilon
  4. namespace igl
  5. {
  6. const double DOUBLE_EPS = 1.0e-14;
  7. const double DOUBLE_EPS_SQ = 1.0e-28;
  8. const float FLOAT_EPS = 1.0e-7;
  9. const float FLOAT_EPS_SQ = 1.0e-14;
  10. // Function returning EPS for corresponding type
  11. template <typename S_type> inline S_type EPS();
  12. // Template specializations for float and double
  13. template <> inline float EPS<float>();
  14. template <> inline double EPS<double>();
  15. }
  16. // Implementation
  17. template <> inline float igl::EPS()
  18. {
  19. return igl::FLOAT_EPS;
  20. }
  21. template <> inline double igl::EPS()
  22. {
  23. return igl::DOUBLE_EPS;
  24. }
  25. #endif