progressive_hulls.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_COPYLEFT_PROGRESSIVE_HULLS_H
  9. #define IGL_COPYLEFT_PROGRESSIVE_HULLS_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. // Assumes (V,F) is a closed manifold mesh
  17. // Collapses edges until desired number of faces is achieved but ensures
  18. // that new vertices are placed outside all previous meshes as per
  19. // "progressive hulls" in "Silhouette clipping" [Sander et al. 2000].
  20. //
  21. // Inputs:
  22. // V #V by dim list of vertex positions
  23. // F #F by 3 list of face indices into V.
  24. // max_m desired number of output faces
  25. // Outputs:
  26. // U #U by dim list of output vertex posistions (can be same ref as V)
  27. // G #G by 3 list of output face indices into U (can be same ref as G)
  28. // Returns true if m was reached (otherwise #G > m)
  29. IGL_INLINE bool progressive_hulls(
  30. const Eigen::MatrixXd & V,
  31. const Eigen::MatrixXi & F,
  32. const size_t max_m,
  33. Eigen::MatrixXd & U,
  34. Eigen::MatrixXi & G);
  35. }
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "progressive_hulls.cpp"
  39. #endif
  40. #endif