frame_field_deformer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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_FRAME_FIELD_DEFORMER_H
  9. #define IGL_FRAME_FIELD_DEFORMER_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. // Deform a mesh to transform the given per-face frame field to be as close
  15. // as possible to a cross field, in the least square sense.
  16. //
  17. // Inputs:
  18. // V #V by 3 coordinates of the vertices
  19. // F #F by 3 list of mesh faces (must be triangles)
  20. // FF1 #F by 3 first representative vector of the frame field
  21. // FF2 #F by 3 second representative vector of the frame field
  22. // lambda laplacian regularization parameter 0=no regularization 1=full regularization
  23. //
  24. // Outputs:
  25. // V_d #F by 3 deformed, first representative vector
  26. // V_d #F by 3 deformed, first representative vector
  27. // V_d #F by 3 deformed, first representative vector
  28. //
  29. IGL_INLINE void frame_field_deformer(
  30. const Eigen::MatrixXd& V,
  31. const Eigen::MatrixXi& F,
  32. const Eigen::MatrixXd& FF1,
  33. const Eigen::MatrixXd& FF2,
  34. Eigen::MatrixXd& V_d,
  35. Eigen::MatrixXd& FF1_d,
  36. Eigen::MatrixXd& FF2_d,
  37. const int iterations = 50,
  38. const double lambda = 0.1,
  39. const bool perturb_initial_guess = true);
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "frame_field_deformer.cpp"
  43. #endif
  44. #endif