directed_edge_orientations.cpp 1.2 KB

12345678910111213141516171819202122232425262728
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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. #include "directed_edge_orientations.h"
  9. template <typename DerivedC, typename DerivedE>
  10. IGL_INLINE void igl::directed_edge_orientations(
  11. const Eigen::MatrixBase<DerivedC> & C,
  12. const Eigen::MatrixBase<DerivedE> & E,
  13. std::vector<
  14. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & Q)
  15. {
  16. Q.resize(E.rows());
  17. for(int e = 0;e<E.rows();e++)
  18. {
  19. const auto & b = C.row(E(e,1)) - C.row(E(e,0));
  20. Q[e].setFromTwoVectors( Eigen::RowVector3d(1,0,0),b);
  21. }
  22. }
  23. #ifdef IGL_STATIC_LIBRARY
  24. // Explicit template instantiation
  25. template void igl::directed_edge_orientations<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<Eigen::Quaternion<double, 0>, Eigen::aligned_allocator<Eigen::Quaternion<double, 0> > >&);
  26. #endif