2
0

centroid.h 1.4 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_CENTROID_H
  9. #define IGL_CENTROID_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Computes the centroid and enclosed volume of a closed mesh using a surface integral.
  15. ///
  16. /// @param[in] V #V by dim list of rest domain positions
  17. /// @param[in] F #F by 3 list of triangle indices into V
  18. /// @param[out] c dim vector of centroid coordinates
  19. /// @param[out] vol total volume of solid.
  20. ///
  21. template <
  22. typename DerivedV,
  23. typename DerivedF,
  24. typename Derivedc,
  25. typename Derivedvol>
  26. IGL_INLINE void centroid(
  27. const Eigen::MatrixBase<DerivedV>& V,
  28. const Eigen::MatrixBase<DerivedF>& F,
  29. Eigen::PlainObjectBase<Derivedc>& c,
  30. Derivedvol & vol);
  31. /// \overload
  32. template <
  33. typename DerivedV,
  34. typename DerivedF,
  35. typename Derivedc>
  36. IGL_INLINE void centroid(
  37. const Eigen::MatrixBase<DerivedV>& V,
  38. const Eigen::MatrixBase<DerivedF>& F,
  39. Eigen::PlainObjectBase<Derivedc>& c);
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "centroid.cpp"
  43. #endif
  44. #endif