volume.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_VOLUME_H
  9. #define IGL_VOLUME_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // VOLUME Compute volume for all tets of a given tet mesh
  15. // (V,T)
  16. //
  17. // vol = volume(V,T)
  18. //
  19. // Inputs:
  20. // V #V by dim list of vertex positions
  21. // T #V by 4 list of tet indices
  22. // Outputs:
  23. // vol #T list of dihedral angles (in radians)
  24. //
  25. template <
  26. typename DerivedV,
  27. typename DerivedT,
  28. typename Derivedvol>
  29. IGL_INLINE void volume(
  30. Eigen::PlainObjectBase<DerivedV>& V,
  31. Eigen::PlainObjectBase<DerivedT>& T,
  32. Eigen::PlainObjectBase<Derivedvol>& vol);
  33. // Intrinsic version:
  34. //
  35. // Inputs:
  36. // L #V by 6 list of edge lengths (see edge_lengths)
  37. template <
  38. typename DerivedL,
  39. typename Derivedvol>
  40. IGL_INLINE void volume(
  41. Eigen::PlainObjectBase<DerivedL>& L,
  42. Eigen::PlainObjectBase<Derivedvol>& vol);
  43. }
  44. #ifdef IGL_HEADER_ONLY
  45. # include "volume.cpp"
  46. #endif
  47. #endif