find_cross_field_singularities.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // Inputs:
  32. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  33. // F #F by 3 eigen Matrix of face (quad) indices
  34. // PD1 #F by 3 eigen Matrix of the first per face cross field vector
  35. // PD2 #F by 3 eigen Matrix of the second per face cross field vector
  36. // Output:
  37. // isSingularity #V by 1 boolean eigen Vector indicating the presence of a singularity on a vertex
  38. // singularityIndex #V by 1 integer eigen Vector containing the singularity indices
  39. //
  40. template <typename DerivedV, typename DerivedF, typename DerivedO>
  41. IGL_INLINE void find_cross_field_singularities(const Eigen::PlainObjectBase<DerivedV> &V,
  42. const Eigen::PlainObjectBase<DerivedF> &F,
  43. const Eigen::PlainObjectBase<DerivedV> &PD1,
  44. const Eigen::PlainObjectBase<DerivedV> &PD2,
  45. Eigen::PlainObjectBase<DerivedO> &isSingularity,
  46. Eigen::PlainObjectBase<DerivedO> &singularityIndex);
  47. }
  48. #ifdef IGL_HEADER_ONLY
  49. #include "find_cross_field_singularities.cpp"
  50. #endif
  51. #endif