faces_first.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef IGL_FACES_FIRST_H
  2. #define IGL_FACES_FIRST_H
  3. #include "igl_inline.h"
  4. namespace igl
  5. {
  6. // FACES_FIRST Reorder vertices so that vertices in face list come before
  7. // vertices that don't appear in the face list. This is especially useful if
  8. // the face list contains only surface faces and you want surface vertices
  9. // listed before internal vertices
  10. //
  11. // [RV,RT,RF,IM] = faces_first(V,T,F);
  12. //
  13. // Templates:
  14. // MatV matrix for vertex positions, e.g. MatrixXd
  15. // MatF matrix for vertex positions, e.g. MatrixXi
  16. // VecI matrix for vertex positions, e.g. VectorXi
  17. // Input:
  18. // V # vertices by 3 vertex positions
  19. // F # faces by 3 list of face indices
  20. // Output:
  21. // RV # vertices by 3 vertex positions, order such that if the jth vertex is
  22. // some face in F, and the kth vertex is not then j comes before k
  23. // RF # faces by 3 list of face indices, reindexed to use RV
  24. // IM # faces by 1 list of indices such that: RF = IM(F) and RT = IM(T)
  25. // and RV(IM,:) = V
  26. //
  27. template <typename MatV, typename MatF, typename VecI>
  28. IGL_INLINE void faces_first(
  29. const MatV & V,
  30. const MatF & F,
  31. MatV & RV,
  32. MatF & RF,
  33. VecI & IM);
  34. }
  35. #ifdef IGL_HEADER_ONLY
  36. # include "faces_first.cpp"
  37. #endif
  38. #endif