find_cross_field_singularities.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <[email protected]>, Olga Diamanti <[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_FIND_CROSS_FIELD_SINGULARITIES_H
  9. #define IGL_FIND_CROSS_FIELD_SINGULARITIES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Computes singularities of a cross field, assumed combed
  15. ///
  16. /// @param[in] V #V by 3 eigen Matrix of mesh vertex 3D positions
  17. /// @param[in] F #F by 3 eigen Matrix of face (quad) indices
  18. /// @param[in] mismatch #F by 3 eigen Matrix containing the integer mismatch of the cross field
  19. /// across all face edges
  20. /// @param[out] isSingularity #V by 1 boolean eigen Vector indicating the presence of a singularity on a vertex
  21. /// @param[out] singularityIndex #V by 1 integer eigen Vector containing the singularity indices
  22. ///
  23. template <typename DerivedV, typename DerivedF, typename DerivedM, typename DerivedO>
  24. IGL_INLINE void find_cross_field_singularities(const Eigen::MatrixBase<DerivedV> &V,
  25. const Eigen::MatrixBase<DerivedF> &F,
  26. const Eigen::MatrixBase<DerivedM> &mismatch,
  27. Eigen::PlainObjectBase<DerivedO> &isSingularity,
  28. Eigen::PlainObjectBase<DerivedO> &singularityIndex);
  29. /// \overload
  30. ///
  31. /// \brief Wrapper that calculates the mismatch if it is not provided.
  32. ///
  33. /// @param[in] PD1 #F by 3 eigen Matrix of the first per face cross field vector
  34. /// @param[in] PD2 #F by 3 eigen Matrix of the second per face cross field vector
  35. /// @param[in] isCombed boolean indicating whether the cross field is combed
  36. ///
  37. /// \note the field in PD1 and PD2 MUST BE combed (see igl::comb_cross_field).
  38. template <typename DerivedV, typename DerivedF, typename DerivedO>
  39. IGL_INLINE void find_cross_field_singularities(const Eigen::MatrixBase<DerivedV> &V,
  40. const Eigen::MatrixBase<DerivedF> &F,
  41. const Eigen::MatrixBase<DerivedV> &PD1,
  42. const Eigen::MatrixBase<DerivedV> &PD2,
  43. Eigen::PlainObjectBase<DerivedO> &isSingularity,
  44. Eigen::PlainObjectBase<DerivedO> &singularityIndex,
  45. bool isCombed = false);
  46. }
  47. #ifndef IGL_STATIC_LIBRARY
  48. #include "find_cross_field_singularities.cpp"
  49. #endif
  50. #endif