mod.cpp 659 B

123456789101112131415161718192021
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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. #include "mod.h"
  9. template <typename DerivedA, typename DerivedB>
  10. IGL_INLINE void igl::mod(
  11. const Eigen::PlainObjectBase<DerivedA> & A,
  12. const int base,
  13. Eigen::PlainObjectBase<DerivedB> & B)
  14. {
  15. B.resize(A.rows(),A.cols());
  16. for(int i = 0;i<B.size();i++)
  17. {
  18. *(B.data()+i) = (*(A.data()+i))%base;
  19. }
  20. }