find_cross_field_singularities.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>, Olga Diamanti <olga.diam@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_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. // Inputs:
  16. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  17. // F #F by 3 eigen Matrix of face (quad) indices
  18. // Handle_MMatch #F by 3 eigen Matrix containing the integer missmatch of the cross field
  19. // across all face edges
  20. // Output:
  21. // isSingularity #V by 1 boolean eigen Vector indicating the presence of a singularity on a vertex
  22. // singularityIndex #V by 1 integer eigen Vector containing the singularity indices
  23. //
  24. template <typename DerivedV, typename DerivedF, typename DerivedM, typename DerivedO>
  25. IGL_INLINE void find_cross_field_singularities(const Eigen::PlainObjectBase<DerivedV> &V,
  26. const Eigen::PlainObjectBase<DerivedF> &F,
  27. const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch,
  28. Eigen::PlainObjectBase<DerivedO> &isSingularity,
  29. Eigen::PlainObjectBase<DerivedO> &singularityIndex);
  30. // Wrapper that calculates the missmatch if it is not provided.
  31. // Note that the field in PD1 and PD2 MUST BE combed (see igl::comb_cross_field).
  32. // Inputs:
  33. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  34. // F #F by 3 eigen Matrix of face (quad) indices
  35. // PD1 #F by 3 eigen Matrix of the first per face cross field vector
  36. // PD2 #F by 3 eigen Matrix of the second per face cross field vector
  37. // Output:
  38. // isSingularity #V by 1 boolean eigen Vector indicating the presence of a singularity on a vertex
  39. // singularityIndex #V by 1 integer eigen Vector containing the singularity indices
  40. //
  41. template <typename DerivedV, typename DerivedF, typename DerivedO>
  42. IGL_INLINE void find_cross_field_singularities(const Eigen::PlainObjectBase<DerivedV> &V,
  43. const Eigen::PlainObjectBase<DerivedF> &F,
  44. const Eigen::PlainObjectBase<DerivedV> &PD1,
  45. const Eigen::PlainObjectBase<DerivedV> &PD2,
  46. Eigen::PlainObjectBase<DerivedO> &isSingularity,
  47. Eigen::PlainObjectBase<DerivedO> &singularityIndex,
  48. bool isCombed = false);
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. #include "find_cross_field_singularities.cpp"
  52. #endif
  53. #endif