bijective_composite_harmonic_mapping.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Alec Jacobson <alecjacobson@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_BIJECTIVE_COMPOSITE_HARMONIC_MAPPING_H
  9. #define IGL_BIJECTIVE_COMPOSITE_HARMONIC_MAPPING_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Compute a planar mapping of a triangulated polygon (V,F) subjected to
  15. // boundary conditions (b,bc). The mapping should be bijective in the sense
  16. // that no triangles' areas become negative (this assumes they started
  17. // positive). This mapping is computed by "composing" harmonic mappings
  18. // between incremental morphs of the boundary conditions. This is a bit like
  19. // a discrete version of "Bijective Composite Mean Value Mappings" [Schneider
  20. // et al. 2013] but with a discrete harmonic map (cf. harmonic coordinates)
  21. // instead of mean value coordinates. This is inspired by "Embedding a
  22. // triangular graph within a given boundary" [Xu et al. 2011].
  23. //
  24. // Inputs:
  25. // V #V by 2 list of triangle mesh vertex positions
  26. // F #F by 3 list of triangle indices into V
  27. // b #b list of boundary indices into V
  28. // bc #b by 2 list of boundary conditions corresponding to b
  29. // Outputs:
  30. // U #V by 2 list of output mesh vertex locations
  31. // Returns true if and only if U contains a successfull bijectie mapping
  32. //
  33. //
  34. template <
  35. typename DerivedV,
  36. typename DerivedF,
  37. typename Derivedb,
  38. typename Derivedbc,
  39. typename DerivedU>
  40. IGL_INLINE bool bijective_composite_harmonic_mapping(
  41. const Eigen::MatrixBase<DerivedV> & V,
  42. const Eigen::MatrixBase<DerivedF> & F,
  43. const Eigen::MatrixBase<Derivedb> & b,
  44. const Eigen::MatrixBase<Derivedbc> & bc,
  45. Eigen::PlainObjectBase<DerivedU> & U);
  46. }
  47. #ifndef IGL_STATIC_LIBRARY
  48. # include "bijective_composite_harmonic_mapping.cpp"
  49. #endif
  50. #endif