upsample.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@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_UPSAMPLE_H
  9. #define IGL_UPSAMPLE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. // History:
  13. // changed templates from generic matrices to PlainObjectBase Alec May 7, 2011
  14. namespace igl
  15. {
  16. // Subdivide a mesh without moving vertices: loop subdivision but odd
  17. // vertices stay put and even vertices are just edge midpoints
  18. //
  19. // Templates:
  20. // MatV matrix for vertex positions, e.g. MatrixXd
  21. // MatF matrix for vertex positions, e.g. MatrixXi
  22. // Inputs:
  23. // V #V by dim mesh vertices
  24. // F #F by 3 mesh triangles
  25. // Outputs:
  26. // NV new vertex positions, V is guaranteed to be at top
  27. // NF new list of face indices
  28. //
  29. // NOTE: V should not be the same as NV,
  30. // NOTE: F should not be the same as NF, use other proto
  31. //
  32. // Known issues:
  33. // - assumes (V,F) is edge-manifold.
  34. template <
  35. typename DerivedV,
  36. typename DerivedF,
  37. typename DerivedNV,
  38. typename DerivedNF>
  39. IGL_INLINE void upsample(
  40. const Eigen::PlainObjectBase<DerivedV>& V,
  41. const Eigen::PlainObjectBase<DerivedF>& F,
  42. Eigen::PlainObjectBase<DerivedNV>& NV,
  43. Eigen::PlainObjectBase<DerivedNF>& NF);
  44. // Virtually in place wrapper
  45. template <
  46. typename MatV,
  47. typename MatF>
  48. IGL_INLINE void upsample(
  49. MatV& V,
  50. MatF& F);
  51. }
  52. #ifndef IGL_STATIC_LIBRARY
  53. # include "upsample.cpp"
  54. #endif
  55. #endif