quats_to_column.cpp 915 B

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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 "quats_to_column.h"
  9. IGL_INLINE void igl::quats_to_column(
  10. const std::vector<
  11. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > vQ,
  12. Eigen::VectorXd & Q)
  13. {
  14. Q.resize(vQ.size()*4);
  15. for(int q = 0;q<(int)vQ.size();q++)
  16. {
  17. auto & xyzw = vQ[q].coeffs();
  18. for(int c = 0;c<4;c++)
  19. {
  20. Q(q*4+c) = xyzw(c);
  21. }
  22. }
  23. }
  24. IGL_INLINE Eigen::VectorXd igl::quats_to_column(
  25. const std::vector<
  26. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > vQ)
  27. {
  28. Eigen::VectorXd Q;
  29. quats_to_column(vQ,Q);
  30. return Q;
  31. }