normalize_row_lengths.cpp 1.1 KB

1234567891011121314151617181920212223242526
  1. #include "normalize_row_lengths.h"
  2. template <typename DerivedV>
  3. IGL_INLINE void igl::normalize_row_lengths(
  4. const Eigen::PlainObjectBase<DerivedV>& A,
  5. Eigen::PlainObjectBase<DerivedV> & B)
  6. {
  7. // Resize output
  8. B.resize(A.rows(),A.cols());
  9. // loop over rows
  10. for(int i = 0; i < A.rows();i++)
  11. {
  12. B.row(i) = A.row(i).normalized();
  13. }
  14. //// Or just:
  15. //B = A;
  16. //B.rowwise().normalize();
  17. }
  18. #ifndef IGL_HEADER_ONLY
  19. // Explicit template specialization
  20. // generated by autoexplicit.sh
  21. template void igl::normalize_row_lengths<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  22. template void igl::normalize_row_lengths<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
  23. template void igl::normalize_row_lengths<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
  24. #endif