EPS.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  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. // Define a standard value for double epsilon
  14. const double DOUBLE_EPS = 1.0e-14;
  15. const double DOUBLE_EPS_SQ = 1.0e-28;
  16. const float FLOAT_EPS = 1.0e-7;
  17. const float FLOAT_EPS_SQ = 1.0e-14;
  18. // Function returning EPS for corresponding type
  19. template <typename S_type> IGL_INLINE S_type EPS();
  20. template <typename S_type> IGL_INLINE S_type EPS_SQ();
  21. // Template specializations for float and double
  22. template <> IGL_INLINE float EPS<float>();
  23. template <> IGL_INLINE double EPS<double>();
  24. template <> IGL_INLINE float EPS_SQ<float>();
  25. template <> IGL_INLINE double EPS_SQ<double>();
  26. }
  27. #ifndef IGL_STATIC_LIBRARY
  28. # include "EPS.cpp"
  29. #endif
  30. #endif