local_basis.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. Eigen::MatrixXd
  19. /// @tparam DerivedF derived from face indices matrix type: i.e. Eigen::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 <
  27. typename DerivedV,
  28. typename DerivedF,
  29. typename DerivedB1,
  30. typename DerivedB2,
  31. typename DerivedB3>
  32. IGL_INLINE void local_basis(
  33. const Eigen::MatrixBase<DerivedV>& V,
  34. const Eigen::MatrixBase<DerivedF>& F,
  35. Eigen::PlainObjectBase<DerivedB1>& B1,
  36. Eigen::PlainObjectBase<DerivedB2>& B2,
  37. Eigen::PlainObjectBase<DerivedB3>& B3
  38. );
  39. }
  40. #ifndef IGL_STATIC_LIBRARY
  41. # include "local_basis.cpp"
  42. #endif
  43. #endif