local_basis.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 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. #ifndef IGL_LOCALBASIS_H
  9. #define IGL_LOCALBASIS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. #include <vector>
  14. namespace igl
  15. {
  16. /// Compute a local orthogonal reference system for each triangle in the given mesh
  17. ///
  18. /// @tparam DerivedV derived from vertex positions matrix type: i.e. MatrixXd
  19. /// @tparam DerivedF derived from face indices matrix type: i.e. MatrixXi
  20. /// @param[in] V eigen matrix #V by 3
  21. /// @param[in] F #F by 3 list of mesh faces (must be triangles)
  22. /// @param[out] B1 eigen matrix #F by 3, each vector is tangent to the triangle
  23. /// @param[out] B2 eigen matrix #F by 3, each vector is tangent to the triangle and perpendicular to B1
  24. /// @param[out] B3 eigen matrix #F by 3, normal of the triangle
  25. ///
  26. template <typename DerivedV, typename DerivedF>
  27. IGL_INLINE void local_basis(
  28. const Eigen::MatrixBase<DerivedV>& V,
  29. const Eigen::MatrixBase<DerivedF>& F,
  30. Eigen::PlainObjectBase<DerivedV>& B1,
  31. Eigen::PlainObjectBase<DerivedV>& B2,
  32. Eigen::PlainObjectBase<DerivedV>& B3
  33. );
  34. }
  35. #ifndef IGL_STATIC_LIBRARY
  36. # include "local_basis.cpp"
  37. #endif
  38. #endif