qslim.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_QSLIM_H
  9. #define IGL_QSLIM_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Decimate (simplify) a triangle mesh in nD according to the paper
  15. // "Simplifying Surfaces with Color and Texture using Quadric Error Metrics"
  16. // by [Garland and Heckbert, 1987] (technically a followup to qslim). The
  17. // mesh can have open boundaries but should be edge-manifold.
  18. //
  19. // Inputs:
  20. // V #V by dim list of vertex positions. Assumes that vertices w
  21. // F #F by 3 list of triangle indices into V
  22. // max_m desired number of output faces
  23. // Outputs:
  24. // U #U by dim list of output vertex posistions (can be same ref as V)
  25. // G #G by 3 list of output face indices into U (can be same ref as G)
  26. // J #G list of indices into F of birth face
  27. // I #U list of indices into V of birth vertices
  28. IGL_INLINE bool qslim(
  29. const Eigen::MatrixXd & V,
  30. const Eigen::MatrixXi & F,
  31. const size_t max_m,
  32. Eigen::MatrixXd & U,
  33. Eigen::MatrixXi & G,
  34. Eigen::VectorXi & J,
  35. Eigen::VectorXi & I);
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "qslim.cpp"
  39. #endif
  40. #endif