EPS.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_EPS_H
  9. #define IGL_EPS_H
  10. #include "igl_inline.h"
  11. namespace igl
  12. {
  13. /// Standard value for double epsilon
  14. const double DOUBLE_EPS = 1.0e-14;
  15. /// Standard value for double epsilon²
  16. const double DOUBLE_EPS_SQ = 1.0e-28;
  17. /// Standard value for single epsilon
  18. const float FLOAT_EPS = 1.0e-7f;
  19. /// Standard value for single epsilon²
  20. const float FLOAT_EPS_SQ = 1.0e-14f;
  21. /// Function returning EPS for corresponding type
  22. template <typename S_type> IGL_INLINE S_type EPS();
  23. /// Function returning EPS_SQ for corresponding type
  24. template <typename S_type> IGL_INLINE S_type EPS_SQ();
  25. // Template specializations for float and double
  26. template <> IGL_INLINE float EPS<float>();
  27. template <> IGL_INLINE double EPS<double>();
  28. template <> IGL_INLINE float EPS_SQ<float>();
  29. template <> IGL_INLINE double EPS_SQ<double>();
  30. }
  31. #ifndef IGL_STATIC_LIBRARY
  32. # include "EPS.cpp"
  33. #endif
  34. #endif