frame_field.h 1.8 KB

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