upsample.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef IGL_UPSAMPLE_H
  2. #define IGL_UPSAMPLE_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. // History:
  6. // changed templates from generic matrices to PlainObjectBase Alec May 7, 2011
  7. namespace igl
  8. {
  9. // Subdivide a mesh without moving vertices: loop subdivision but odd
  10. // vertices stay put and even vertices are just edge midpoints
  11. //
  12. // Templates:
  13. // MatV matrix for vertex positions, e.g. MatrixXd
  14. // MatF matrix for vertex positions, e.g. MatrixXi
  15. // Inputs:
  16. // V #V by dim mesh vertices
  17. // F #F by 3 mesh triangles
  18. // Outputs:
  19. // NV new vertex positions, V is guaranteed to be at top
  20. // NF new list of face indices
  21. //
  22. // NOTE: V should not be the same as NV,
  23. // NOTE: F should not be the same as NF, use other proto
  24. template <
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename DerivedNV,
  28. typename DerivedNF>
  29. IGL_INLINE void upsample(
  30. const Eigen::PlainObjectBase<DerivedV>& V,
  31. const Eigen::PlainObjectBase<DerivedF>& F,
  32. Eigen::PlainObjectBase<DerivedNV>& NV,
  33. Eigen::PlainObjectBase<DerivedNF>& NF);
  34. // Virtually in place wrapper
  35. template <
  36. typename MatV,
  37. typename MatF>
  38. IGL_INLINE void upsample(
  39. MatV& V,
  40. MatF& F);
  41. }
  42. #ifdef IGL_HEADER_ONLY
  43. # include "upsample.cpp"
  44. #endif
  45. #endif