frame_field.h 1.8 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_FRAMEFIELD_H
  9. #define IGL_FRAMEFIELD_H
  10. #include <Eigen/Dense>
  11. #include <vector>
  12. namespace igl
  13. {
  14. // Generate a piecewise-constant frame-field field from a sparse set of constraints on faces
  15. // using the algorithm proposed in:
  16. // Frame Fields: Anisotropic and Non-Orthogonal Cross Fields
  17. // Daniele Panozzo, Enrico Puppo, Marco Tarini, Olga Sorkine-Hornung,
  18. // ACM Transactions on Graphics (SIGGRAPH, 2014)
  19. //
  20. // Inputs:
  21. // V #V by 3 list of mesh vertex coordinates
  22. // F #F by 3 list of mesh faces (must be triangles)
  23. // b #B by 1 list of constrained face indices
  24. // bc1 #B by 3 list of the constrained first representative vector of the frame field (up to permutation and sign)
  25. // bc2 #B by 3 list of the constrained second representative vector of the frame field (up to permutation and sign)
  26. //
  27. // Outputs:
  28. // FF1 #F by 3 the first representative vector of the frame field (up to permutation and sign)
  29. // FF2 #F by 3 the second representative vector of the frame field (up to permutation and sign)
  30. //
  31. // TODO: it now supports only soft constraints, should be extended to support both hard and soft constraints
  32. IGL_INLINE void frame_field(
  33. const Eigen::MatrixXd& V,
  34. const Eigen::MatrixXi& F,
  35. const Eigen::VectorXi& b,
  36. const Eigen::MatrixXd& bc1,
  37. const Eigen::MatrixXd& bc2,
  38. Eigen::MatrixXd& FF1,
  39. Eigen::MatrixXd& FF2
  40. );
  41. }
  42. #ifdef IGL_HEADER_ONLY
  43. # include "frame_field.cpp"
  44. #endif
  45. #endif