polyvector_field_poisson_reconstruction.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_POLYVECTOR_FIELD_POISSON_RECONSTRUCTION
  9. #define IGL_POLYVECTOR_FIELD_POISSON_RECONSTRUCTION
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl {
  14. // Poisson integration on a combed n-polyvector field, defined on a cut mesh.
  15. // The function finds n new integrable vector fields that are as close as possible to the
  16. // N-vector fields of the original combed polyvector field. Integrable means
  17. // that the vector fields are gradients of scalar functions. The deviation from the input
  18. // field measures how much the input field deviates from integrability.
  19. // Inputs:
  20. // Vcut #V by 3 list of the vertex positions
  21. // Fcut #F by 3 list of the faces (must be triangles)
  22. // sol3D_combed #F by 3n list of the 3D coordinates of the per-face vectors of the combed vector set field
  23. // (stacked horizontally for each triangle). Vector #1 in one face will match vector #1 in
  24. // the adjacent face.
  25. // Outputs:
  26. // scalars #V by n list of the per-vertex scalar functions of which the input field
  27. // is approximately the gradients
  28. // sol3D_recon #F by 3n list of the 3D coordinates of the per-face vectors of the reconstructed
  29. // vector set fields (stacked horizontally for each triangle). The fields are the
  30. // gradients of the scalar functions sF.
  31. // max_error #V by 1 list of the maximal (across the n vector fields) reconstruction error.
  32. //
  33. template <typename DerivedV, typename DerivedF, typename DerivedSF, typename DerivedS, typename DerivedE>
  34. IGL_INLINE double polyvector_field_poisson_reconstruction(
  35. const Eigen::PlainObjectBase<DerivedV> &Vcut,
  36. const Eigen::PlainObjectBase<DerivedF> &Fcut,
  37. const Eigen::PlainObjectBase<DerivedS> &sol3D_combed,
  38. Eigen::PlainObjectBase<DerivedSF> &scalars,
  39. Eigen::PlainObjectBase<DerivedS> &sol3D_recon,
  40. Eigen::PlainObjectBase<DerivedE> &max_error );
  41. };
  42. #ifndef IGL_STATIC_LIBRARY
  43. #include "polyvector_field_poisson_reconstruction.cpp"
  44. #endif
  45. #endif /* defined(IGL_POLYVECTOR_FIELD_POISSON_RECONSTRUCTION) */