vf.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef IGL_VF_H
  2. #define IGL_VF_H
  3. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  4. #include <Eigen/Dense>
  5. #include <Eigen/Sparse>
  6. namespace igl
  7. {
  8. // Constructs the vertex-face topology of a given mesh (V,F)
  9. // Inputs:
  10. // V #V by 3 list of vertex coordinates
  11. // F #F by dim list of mesh faces (must be triangles)
  12. // Outputs:
  13. // A vector<vector<int>> of face indices, each row i corresponding to V(i,:)
  14. //
  15. // See also: edges, cotmatrix, diag, vv
  16. template <typename T>
  17. inline void vf(
  18. const Eigen::MatrixXd & V,
  19. const Eigen::MatrixXi & F,
  20. vector<vector<T> >& Al);
  21. }
  22. // Implementation
  23. #include "verbose.h"
  24. template <typename T>
  25. inline void igl::vf(
  26. const Eigen::MatrixXd & V,
  27. const Eigen::MatrixXi & F,
  28. vector<vector<T> >& Al)
  29. {
  30. Al.clear;
  31. Al.resize(V.rows());
  32. // Loop over faces
  33. for(int i = 0;i<F.rows();i++)
  34. {
  35. // Loop over this face
  36. for(int j = 0;j<F.cols();j++)
  37. {
  38. Al[F(i,j)].push_back();
  39. }
  40. }
  41. A = Eigen::SparseMatrix<T>(dyn_A);
  42. }
  43. #endif