remove_duplicates.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_REMOVE_DUPLICATES_H
  9. #define IGL_REMOVE_DUPLICATES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // [ NV, NF ] = remove_duplicates( 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 remove_duplicates(
  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 remove_duplicates(
  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. #ifndef IGL_STATIC_LIBRARY
  41. # include "remove_duplicates.cpp"
  42. #endif
  43. #endif