swept_volume_signed_distance.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef IGL_SWEPT_VOLUME_SIGNED_DISTANCE_H
  2. #define IGL_SWEPT_VOLUME_SIGNED_DISTANCE_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <Eigen/Geometry>
  6. #include <functional>
  7. namespace igl
  8. {
  9. // Compute the signed distance to a sweep surface of a mesh under-going
  10. // an arbitrary motion V(t) discretely sampled at `steps`-many moments in
  11. // time at a grid.
  12. //
  13. // Inputs:
  14. // V #V by 3 list of mesh positions in reference pose
  15. // F #F by 3 list of triangle indices [0,n)
  16. // transform function handle so that transform(t) returns the rigid
  17. // transformation at time t∈[0,1]
  18. // steps number of time steps: steps=3 --> t∈{0,0.5,1}
  19. // GV #GV by 3 list of evaluation point grid positions
  20. // res 3-long resolution of GV grid
  21. // h edge-length of grid
  22. // isolevel isolevel to "focus" on; grid positions far enough away from
  23. // isolevel (based on h) will get approximate values). Set
  24. // isolevel=infinity to get good values everywhere (slow and
  25. // unnecessary if just trying to extract isolevel-level set).
  26. // S0 #GV initial values (will take minimum with these), can be same
  27. // as S)
  28. // Outputs:
  29. // S #GV list of signed distances
  30. IGL_INLINE void swept_volume_signed_distance(
  31. const Eigen::MatrixXd & V,
  32. const Eigen::MatrixXi & F,
  33. const std::function<Eigen::Affine3d(const double t)> & transform,
  34. const size_t & steps,
  35. const Eigen::MatrixXd & GV,
  36. const Eigen::RowVector3i & res,
  37. const double h,
  38. const double isolevel,
  39. const Eigen::VectorXd & S0,
  40. Eigen::VectorXd & S);
  41. IGL_INLINE void swept_volume_signed_distance(
  42. const Eigen::MatrixXd & V,
  43. const Eigen::MatrixXi & F,
  44. const std::function<Eigen::Affine3d(const double t)> & transform,
  45. const size_t & steps,
  46. const Eigen::MatrixXd & GV,
  47. const Eigen::RowVector3i & res,
  48. const double h,
  49. const double isolevel,
  50. Eigen::VectorXd & S);
  51. }
  52. #ifndef IGL_STATIC_LIBRARY
  53. # include "swept_volume_signed_distance.cpp"
  54. #endif
  55. #endif