swept_volume_signed_distance.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <[email protected]>
  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. /// @param[in] V #V by 3 list of mesh positions in reference pose
  21. /// @param[in] F #F by 3 list of triangle indices [0,n)
  22. /// @param[in] transform function handle so that transform(t) returns the rigid
  23. /// transformation at time t∈[0,1]
  24. /// @param[in] steps number of time steps: steps=3 --> t∈{0,0.5,1}
  25. /// @param[in] GV #GV by 3 list of evaluation point grid positions
  26. /// @param[in] res 3-long resolution of GV grid
  27. /// @param[in] h edge-length of grid
  28. /// @param[in] isolevel isolevel to "focus" on; grid positions far enough away from
  29. /// isolevel (based on h) will get approximate values). Set
  30. /// isolevel=infinity to get good values everywhere (slow and
  31. /// unnecessary if just trying to extract isolevel-level set).
  32. /// @param[in] S0 #GV initial values (will take minimum with these), can be same
  33. /// as S)
  34. /// @param[out] S #GV list of signed distances
  35. IGL_INLINE void swept_volume_signed_distance(
  36. const Eigen::MatrixXd & V,
  37. const Eigen::MatrixXi & F,
  38. const std::function<Eigen::Affine3d(const double t)> & transform,
  39. const size_t & steps,
  40. const Eigen::MatrixXd & GV,
  41. const Eigen::RowVector3i & res,
  42. const double h,
  43. const double isolevel,
  44. const Eigen::VectorXd & S0,
  45. Eigen::VectorXd & S);
  46. /// \overload
  47. IGL_INLINE void swept_volume_signed_distance(
  48. const Eigen::MatrixXd & V,
  49. const Eigen::MatrixXi & F,
  50. const std::function<Eigen::Affine3d(const double t)> & transform,
  51. const size_t & steps,
  52. const Eigen::MatrixXd & GV,
  53. const Eigen::RowVector3i & res,
  54. const double h,
  55. const double isolevel,
  56. Eigen::VectorXd & S);
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. # include "swept_volume_signed_distance.cpp"
  60. #endif
  61. #endif