frame_field.h 1.9 KB

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