cotangent.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef IGL_COTANGENT_H
  9. #define IGL_COTANGENT_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // COTANGENT compute the cotangents of each angle in mesh (V,F)
  15. //
  16. // Templates:
  17. // MatV vertex position matrix, e.g. Eigen::MatrixXd
  18. // MatF face index matrix, e.g. Eigen::MatrixXd
  19. // MatC cotangent weights matrix, e.g. Eigen::MatrixXd
  20. // Inputs:
  21. // V #V by dim list of rest domain positions
  22. // F #F by {3|4} list of {triangle|tetrahedra} indices into V
  23. // Outputs:
  24. // C #F by {3|6} list of cotangents corresponding angles
  25. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  26. // for tets, columns correspond to edges
  27. // [1,2],[2,0],[0,1],[3,0],[3,1],[3,2] **times corresponding edge
  28. // lengths**
  29. //
  30. // Known bug:
  31. // This computes 0.5*cotangent
  32. template <typename DerivedV, typename DerivedF, typename DerivedC>
  33. IGL_INLINE void cotangent(
  34. const Eigen::PlainObjectBase<DerivedV>& V,
  35. const Eigen::PlainObjectBase<DerivedF>& F,
  36. Eigen::PlainObjectBase<DerivedC>& C);
  37. }
  38. #ifdef IGL_HEADER_ONLY
  39. # include "cotangent.cpp"
  40. #endif
  41. #endif