nrosy.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_NROSY_H
  9. #define IGL_COMISO_NROSY_H
  10. #include <Eigen/Core>
  11. #include <Eigen/Sparse>
  12. #include "../../igl_inline.h"
  13. namespace igl
  14. {
  15. namespace copyleft
  16. {
  17. namespace comiso
  18. {
  19. // Generate a N-RoSy field from a sparse set of constraints
  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. // bc #B by 3 list of representative vectors for the constrained
  26. // faces
  27. // b_soft #S by 1 b for soft constraints
  28. // w_soft #S by 1 weight for the soft constraints (0-1)
  29. // bc_soft #S by 3 bc for soft constraints
  30. // N the degree of the N-RoSy vector field
  31. // soft the strength of the soft constraints w.r.t. smoothness
  32. // (0 -> smoothness only, 1->constraints only)
  33. // Outputs:
  34. // R #F by 3 the representative vectors of the interpolated field
  35. // S #V by 1 the singularity index for each vertex (0 = regular)
  36. IGL_INLINE void nrosy(
  37. const Eigen::MatrixXd& V,
  38. const Eigen::MatrixXi& F,
  39. const Eigen::VectorXi& b,
  40. const Eigen::MatrixXd& bc,
  41. const Eigen::VectorXi& b_soft,
  42. const Eigen::VectorXd& w_soft,
  43. const Eigen::MatrixXd& bc_soft,
  44. int N,
  45. double soft,
  46. Eigen::MatrixXd& R,
  47. Eigen::VectorXd& S
  48. );
  49. //wrapper for the case without soft constraints
  50. IGL_INLINE void nrosy(
  51. const Eigen::MatrixXd& V,
  52. const Eigen::MatrixXi& F,
  53. const Eigen::VectorXi& b,
  54. const Eigen::MatrixXd& bc,
  55. int N,
  56. Eigen::MatrixXd& R,
  57. Eigen::VectorXd& S
  58. );
  59. }
  60. }
  61. }
  62. #ifndef IGL_STATIC_LIBRARY
  63. # include "nrosy.cpp"
  64. #endif
  65. #endif