nrosy.h 2.2 KB

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