loop.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Oded Stein <oded.stein@columbia.edu>
  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_LOOP_H
  9. #define IGL_LOOP_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. // LOOP Given the triangle mesh [V, F], where n_verts = V.rows(), computes newV and a sparse matrix S s.t. [newV, newF] is the subdivided mesh where newV = S*V.
  16. //
  17. // Inputs:
  18. // n_verts an integer (number of mesh vertices)
  19. // F an m by 3 matrix of integers of triangle faces
  20. // Outputs:
  21. // S a sparse matrix (will become the subdivision matrix)
  22. // newF a matrix containing the new faces
  23. IGL_INLINE void loop(const int n_verts,
  24. const Eigen::MatrixXi& F,
  25. Eigen::SparseMatrix<double>& S,
  26. Eigen::MatrixXi& newF);
  27. // LOOP Given the triangle mesh [V, F], computes number_of_subdivs steps of loop subdivision and outputs the new mesh [newV, newF]
  28. //
  29. // Inputs:
  30. // V an n by 3 matrix of vertices
  31. // F an m by 3 matrix of integers of triangle faces
  32. // number_of_subdivs an integer that specifies how many subdivision steps to do
  33. // Outputs:
  34. // newV a matrix containing the new vertices
  35. // newF a matrix containing the new faces
  36. IGL_INLINE void loop(const Eigen::MatrixXd& V,
  37. const Eigen::MatrixXi& F,
  38. Eigen::MatrixXd& newV,
  39. Eigen::MatrixXi& newF,
  40. const int number_of_subdivs = 1);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. #include "loop.cpp"
  44. #endif
  45. #endif