removeDuplicates.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // removeDuplicates.h
  3. // Preview3D
  4. //
  5. // Created by Olga Diamanti on 17/11/11.
  6. // Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  7. //
  8. #ifndef IGL_REMOVEDUPLICATES_H
  9. #define IGL_REMOVEDUPLICATES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // [ NV, NF ] = removeDuplicates( V,F,epsilon )
  15. // Merge the duplicate vertices from V, fixing the topology accordingly
  16. //
  17. // Input:
  18. // V,F: mesh description
  19. // epsilon: minimal distance to consider two vertices identical
  20. //
  21. // Output:
  22. // NV, NF: new mesh without duplicate vertices
  23. // template <typename T, typename S>
  24. // IGL_INLINE void removeDuplicates(
  25. // const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
  26. // const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic> &F,
  27. // Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &NV,
  28. // Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic> &NF,
  29. // Eigen::Matrix<S, Eigen::Dynamic, 1> &I,
  30. // const double epsilon = 2.2204e-15);
  31. template <typename DerivedV, typename DerivedF>
  32. IGL_INLINE void removeDuplicates(
  33. const Eigen::PlainObjectBase<DerivedV> &V,
  34. const Eigen::PlainObjectBase<DerivedF> &F,
  35. Eigen::PlainObjectBase<DerivedV> &NV,
  36. Eigen::PlainObjectBase<DerivedF> &NF,
  37. Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 1> &I,
  38. const double epsilon = 2.2204e-15);
  39. }
  40. #ifdef IGL_HEADER_ONLY
  41. # include "removeDuplicates.cpp"
  42. #endif
  43. #endif