round.h 651 B

123456789101112131415161718192021222324252627282930
  1. #ifndef IGL_ROUND_H
  2. #define IGL_ROUND_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. namespace igl
  6. {
  7. // Round a scalar value
  8. //
  9. // Inputs:
  10. // x number
  11. // Returns x rounded to integer
  12. template <typename DerivedX>
  13. DerivedX round(const DerivedX r);
  14. // Round a given matrix to nearest integers
  15. //
  16. // Inputs:
  17. // X m by n matrix of scalars
  18. // Outputs:
  19. // Y m by n matrix of rounded integers
  20. template < typename DerivedX, typename DerivedY>
  21. IGL_INLINE void round(
  22. const Eigen::PlainObjectBase<DerivedX>& X,
  23. Eigen::PlainObjectBase<DerivedY>& Y);
  24. }
  25. #ifdef IGL_HEADER_ONLY
  26. # include "round.cpp"
  27. #endif
  28. #endif