piecewise_constant_winding_number.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson
  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_PIECEWISE_CONSTANT_WINDING_NUMBER_H
  9. #define IGL_PIECEWISE_CONSTANT_WINDING_NUMBER_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. /// Determine if a given mesh induces a piecewise constant winding number
  16. /// field: Is this mesh valid input to solid set operations. **Assumes** that
  17. /// `(V,F)` contains no self-intersections (including degeneracies and
  18. /// co-incidences). If there are co-planar and co-incident vertex placements,
  19. /// a mesh could _fail_ this combinatorial test but still induce a
  20. /// piecewise-constant winding number _geometrically_. For example, consider a
  21. /// hemisphere with boundary and then pinch the boundary "shut" along a line
  22. /// segment. The **_bullet-proof_** check is to first resolve all
  23. /// self-intersections in `(V,F) -> (SV,SF)` (i.e. what the
  24. /// `igl::copyleft::cgal::piecewise_constant_winding_number` overload does).
  25. ///
  26. /// @param[in] F #F by 3 list of triangle indices into some (abstract) list of
  27. /// vertices V
  28. /// @param[in] uE #uE by 2 list of unique edges indices into V
  29. /// @param[in] uEC #uE+1 list of cumsums of directed edges sharing each unique edge
  30. /// @param[in] uEE #E list of indices into E (see `igl::unique_edge_map`)
  31. /// @return true if the mesh _combinatorially_ induces a piecewise constant
  32. /// winding number field.
  33. ///
  34. template <
  35. typename DerivedF,
  36. typename DeriveduE,
  37. typename DeriveduEC,
  38. typename DeriveduEE>
  39. IGL_INLINE bool piecewise_constant_winding_number(
  40. const Eigen::MatrixBase<DerivedF>& F,
  41. const Eigen::MatrixBase<DeriveduE>& uE,
  42. const Eigen::MatrixBase<DeriveduEC>& uEC,
  43. const Eigen::MatrixBase<DeriveduEE>& uEE);
  44. /// \overload
  45. template <typename DerivedF>
  46. IGL_INLINE bool piecewise_constant_winding_number(
  47. const Eigen::MatrixBase<DerivedF>& F);
  48. }
  49. #ifndef IGL_STATIC_LIBRARY
  50. # include "piecewise_constant_winding_number.cpp"
  51. #endif
  52. #endif