normal_derivative.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_NORMAL_DERIVATIVE_H
  9. #define IGL_NORMAL_DERIVATIVE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. // NORMAL_DERIVATIVE Computes the directional derivative **normal** to
  16. // **all** (half-)edges of a triangle mesh (not just boundary edges). These
  17. // are integrated along the edge: they're the per-face constant gradient dot
  18. // the rotated edge vector (unit rotated edge vector for direction then
  19. // magnitude for integration).
  20. //
  21. // Inputs:
  22. // V #V by dim list of mesh vertex positions
  23. // F #F by 3|4 list of triangle|tetrahedron indices into V
  24. // Outputs:
  25. // DD #F*3|4 by #V sparse matrix representing operator to compute
  26. // directional derivative with respect to each facet of each element.
  27. //
  28. template <
  29. typename DerivedV,
  30. typename DerivedEle,
  31. typename Scalar>
  32. IGL_INLINE void normal_derivative(
  33. const Eigen::PlainObjectBase<DerivedV> & V,
  34. const Eigen::PlainObjectBase<DerivedEle> & Ele,
  35. Eigen::SparseMatrix<Scalar>& DD);
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "normal_derivative.cpp"
  39. #endif
  40. #endif