resolve_duplicated_faces.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <[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. //
  9. #ifndef IGL_COPYLEFT_RESOLVE_DUPLICATED_FACES
  10. #define IGL_COPYLEFT_RESOLVE_DUPLICATED_FACES
  11. #include "igl_inline.h"
  12. #include <Eigen/Core>
  13. namespace igl {
  14. /// Resolve duplicated faces according to the following rules per unique face:
  15. ///
  16. /// 1. If the number of positively oriented faces equals the number of
  17. /// negatively oriented faces, remove all duplicated faces at this triangle.
  18. /// 2. If the number of positively oriented faces equals the number of
  19. /// negatively oriented faces plus 1, keeps one of the positively oriented
  20. /// face.
  21. /// 3. If the number of positively oriented faces equals the number of
  22. /// negatively oriented faces minus 1, keeps one of the negatively oriented
  23. /// face.
  24. /// 4. If the number of postively oriented faces differ with the number of
  25. /// negativley oriented faces by more than 1, the mesh is not orientable.
  26. /// An exception will be thrown.
  27. ///
  28. /// @param[in] F1 #F1 by 3 array of input faces.
  29. /// @param[out] F2 #F2 by 3 array of output faces without duplicated faces.
  30. /// @param[out] J #F2 list of indices into F1.
  31. template<
  32. typename DerivedF1,
  33. typename DerivedF2,
  34. typename DerivedJ >
  35. IGL_INLINE void resolve_duplicated_faces(
  36. const Eigen::MatrixBase<DerivedF1>& F1,
  37. Eigen::PlainObjectBase<DerivedF2>& F2,
  38. Eigen::PlainObjectBase<DerivedJ>& J);
  39. }
  40. #ifndef IGL_STATIC_LIBRARY
  41. # include "resolve_duplicated_faces.cpp"
  42. #endif
  43. #endif