conjugate_frame_fields.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Olga Diamanti <olga.diam@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. #ifndef IGL_CONJUGATE_FRAME_FIELDS
  9. #define IGL_CONJUGATE_FRAME_FIELDS
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl {
  14. //todo
  15. // TODO: isConstrained should become a list of indices for consistency with
  16. // n_polyvector
  17. /// Given 2 vectors centered on origin calculate the rotation matrix from first to the second
  18. // Inputs:
  19. // v0, v1 the two #3 by 1 vectors
  20. // normalized boolean, if false, then the vectors are normalized prior to the calculation
  21. // Output:
  22. // 3 by 3 rotation matrix that takes v0 to v1
  23. //
  24. template <typename DerivedV, typename DerivedF>
  25. class ConjugateFFSolverData;
  26. template <typename DerivedV, typename DerivedF, typename DerivedO>
  27. IGL_INLINE void conjugate_frame_fields(const Eigen::PlainObjectBase<DerivedV> &V,
  28. const Eigen::PlainObjectBase<DerivedF> &F,
  29. const Eigen::VectorXi &isConstrained,
  30. const Eigen::PlainObjectBase<DerivedO> &initialSolution,
  31. Eigen::PlainObjectBase<DerivedO> &output,
  32. int _maxIter = 50,
  33. const typename DerivedV::Scalar &_lambdaOrtho = .1,
  34. const typename DerivedV::Scalar &_lambdaInit = 100,
  35. const typename DerivedV::Scalar &_lambdaMultFactor = 1.01,
  36. bool _doHardConstraints = true);
  37. template <typename DerivedV, typename DerivedF, typename DerivedO>
  38. IGL_INLINE void conjugate_frame_fields(const ConjugateFFSolverData<DerivedV, DerivedF> &csdata,
  39. const Eigen::VectorXi &isConstrained,
  40. const Eigen::PlainObjectBase<DerivedO> &initialSolution,
  41. Eigen::PlainObjectBase<DerivedO> &output,
  42. int _maxIter = 50,
  43. const typename DerivedV::Scalar &_lambdaOrtho = .1,
  44. const typename DerivedV::Scalar &_lambdaInit = 100,
  45. const typename DerivedV::Scalar &_lambdaMultFactor = 1.01,
  46. bool _doHardConstraints = true,
  47. typename DerivedV::Scalar *lambdaOut = NULL);
  48. };
  49. #ifndef IGL_STATIC_LIBRARY
  50. #include "conjugate_frame_fields.cpp"
  51. #endif
  52. #endif /* defined(IGL_CONJUGATE_FRAME_FIELDS) */