removeDuplicates.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }
  32. #ifdef IGL_HEADER_ONLY
  33. # include "removeDuplicates.cpp"
  34. #endif
  35. #endif