vertex_triangle_adjacency.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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_VERTEX_TRIANGLE_ADJACENCY_H
  9. #define IGL_VERTEX_TRIANGLE_ADJACENCY_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Dense>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // vertex_face_adjacency constructs the vertex-face topology of a given mesh (V,F)
  16. //
  17. // Inputs:
  18. // //V #V by 3 list of vertex coordinates
  19. // n number of vertices #V (e.g. `F.maxCoeff()+1` or `V.rows()`)
  20. // F #F by dim list of mesh faces (must be triangles)
  21. // Outputs:
  22. // VF #V list of lists of incident faces (adjacency list)
  23. // VI #V list of lists of index of incidence within incident faces listed
  24. // in VF
  25. //
  26. // See also: edges, cotmatrix, diag, vv
  27. //
  28. // Known bugs: this should not take V as an input parameter.
  29. // Known bugs/features: if a facet is combinatorially degenerate then faces
  30. // will appear multiple times in VF and correpondingly in VFI (j appears
  31. // twice in F.row(i) then i will appear twice in VF[j])
  32. template <typename DerivedF, typename VFType, typename VFiType>
  33. IGL_INLINE void vertex_triangle_adjacency(
  34. const typename DerivedF::Scalar n,
  35. const Eigen::PlainObjectBase<DerivedF>& F,
  36. std::vector<std::vector<VFType> >& VF,
  37. std::vector<std::vector<VFiType> >& VFi);
  38. template <typename DerivedV, typename DerivedF, typename IndexType>
  39. IGL_INLINE void vertex_triangle_adjacency(
  40. const Eigen::PlainObjectBase<DerivedV>& V,
  41. const Eigen::PlainObjectBase<DerivedF>& F,
  42. std::vector<std::vector<IndexType> >& VF,
  43. std::vector<std::vector<IndexType> >& VFi);
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "vertex_triangle_adjacency.cpp"
  47. #endif
  48. #endif