swept_volume_signed_distance.h 2.3 KB

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