frame_field.h 1.8 KB

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