remove_duplicate_vertices.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  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_DUPLICATE_VERTICES_H
  9. #define IGL_REMOVE_DUPLICATE_VERTICES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. /// Remove duplicate vertices upto a uniqueness tolerance (epsilon)
  15. ///
  16. /// @param[in] V #V by dim list of vertex positions
  17. /// @param[in] epsilon uniqueness tolerance used coordinate-wise: 1e0 --> integer
  18. /// match, 1e-1 --> match up to first decimal, ... , 0 --> exact match.
  19. /// @param[out] SV #SV by dim new list of vertex positions
  20. /// @param[out] SVI #SV by 1 list of indices so SV = V(SVI,:)
  21. /// @param[out] SVJ #V by 1 list of indices so V = SV(SVJ,:)
  22. ///
  23. template <
  24. typename DerivedV,
  25. typename DerivedSV,
  26. typename DerivedSVI,
  27. typename DerivedSVJ>
  28. IGL_INLINE void remove_duplicate_vertices(
  29. const Eigen::MatrixBase<DerivedV>& V,
  30. const double epsilon,
  31. Eigen::PlainObjectBase<DerivedSV>& SV,
  32. Eigen::PlainObjectBase<DerivedSVI>& SVI,
  33. Eigen::PlainObjectBase<DerivedSVJ>& SVJ);
  34. /// \overload
  35. /// \brief Wrapper that also remaps given faces (F) --> (SF) so that SF index SV
  36. /// @param[out] SF #F by dim list of face indices into SV
  37. template <
  38. typename DerivedV,
  39. typename DerivedF,
  40. typename DerivedSV,
  41. typename DerivedSVI,
  42. typename DerivedSVJ,
  43. typename DerivedSF>
  44. IGL_INLINE void remove_duplicate_vertices(
  45. const Eigen::MatrixBase<DerivedV>& V,
  46. const Eigen::MatrixBase<DerivedF>& F,
  47. const double epsilon,
  48. Eigen::PlainObjectBase<DerivedSV>& SV,
  49. Eigen::PlainObjectBase<DerivedSVI>& SVI,
  50. Eigen::PlainObjectBase<DerivedSVJ>& SVJ,
  51. Eigen::PlainObjectBase<DerivedSF>& SF);
  52. }
  53. #ifndef IGL_STATIC_LIBRARY
  54. # include "remove_duplicate_vertices.cpp"
  55. #endif
  56. #endif