nrosy.h 2.1 KB

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