frame_field.h 1.9 KB

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