nrosy.h 1.9 KB

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