qslim.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 with
  21. // infinite coordinates are "points at infinity" being used to close up
  22. // boundary edges with faces. This allows special subspace quadrice for
  23. // boundary edges: There should never be more than one "point at
  24. // infinity" in a single triangle.
  25. // F #F by 3 list of triangle indices into V
  26. // max_m desired number of output faces
  27. // Outputs:
  28. // U #U by dim list of output vertex posistions (can be same ref as V)
  29. // G #G by 3 list of output face indices into U (can be same ref as F)
  30. // J #G list of indices into F of birth face
  31. // I #U list of indices into V of birth vertices
  32. IGL_INLINE bool qslim(
  33. const Eigen::MatrixXd & V,
  34. const Eigen::MatrixXi & F,
  35. const size_t max_m,
  36. Eigen::MatrixXd & U,
  37. Eigen::MatrixXi & G,
  38. Eigen::VectorXi & J,
  39. Eigen::VectorXi & I);
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "qslim.cpp"
  43. #endif
  44. #endif