directed_edge_orientations.cpp 1.3 KB

1234567891011121314151617181920212223242526272829
  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 "directed_edge_orientations.h"
  9. template <typename DerivedC, typename DerivedE>
  10. IGL_INLINE void igl::directed_edge_orientations(
  11. const Eigen::PlainObjectBase<DerivedC> & C,
  12. const Eigen::PlainObjectBase<DerivedE> & E,
  13. std::vector<
  14. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & Q)
  15. {
  16. using namespace Eigen;
  17. Q.resize(E.rows());
  18. for(int e = 0;e<E.rows();e++)
  19. {
  20. const auto & b = C.row(E(e,1)) - C.row(E(e,0));
  21. Q[e].setFromTwoVectors( RowVector3d(1,0,0),b);
  22. }
  23. }
  24. #ifdef IGL_STATIC_LIBRARY
  25. // Explicit template specialization
  26. template void igl::directed_edge_orientations<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<Eigen::Quaternion<double, 0>, Eigen::aligned_allocator<Eigen::Quaternion<double, 0> > >&);
  27. #endif