nrosy.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 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 strenght of the soft contraints 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. const int N,
  45. const 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. const int N,
  56. Eigen::MatrixXd& R,
  57. Eigen::VectorXd& S
  58. );
  59. }
  60. }
  61. #ifndef IGL_STATIC_LIBRARY
  62. # include "nrosy.cpp"
  63. #endif
  64. #endif