local_basis.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 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. #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. // Templates:
  18. // DerivedV derived from vertex positions matrix type: i.e. MatrixXd
  19. // DerivedF derived from face indices matrix type: i.e. MatrixXi
  20. // Inputs:
  21. // V eigen matrix #V by 3
  22. // F #F by 3 list of mesh faces (must be triangles)
  23. // Outputs:
  24. // B1 eigen matrix #F by 3, each vector is tangent to the triangle
  25. // B2 eigen matrix #F by 3, each vector is tangent to the triangle and perpendicular to B1
  26. // B3 eigen matrix #F by 3, normal of the triangle
  27. //
  28. // See also: adjacency_matrix
  29. template <typename DerivedV, typename DerivedF>
  30. IGL_INLINE void local_basis(
  31. const Eigen::PlainObjectBase<DerivedV>& V,
  32. const Eigen::PlainObjectBase<DerivedF>& F,
  33. Eigen::PlainObjectBase<DerivedV>& B1,
  34. Eigen::PlainObjectBase<DerivedV>& B2,
  35. Eigen::PlainObjectBase<DerivedV>& B3
  36. );
  37. }
  38. #ifndef IGL_STATIC_LIBRARY
  39. # include "local_basis.cpp"
  40. #endif
  41. #endif