swept_volume_bounding_box.cpp 855 B

123456789101112131415161718192021222324252627
  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. #include "swept_volume_bounding_box.h"
  9. IGL_INLINE void igl::swept_volume_bounding_box(
  10. const size_t & n,
  11. const std::function<Eigen::RowVector3d(const size_t vi, const double t)> & V,
  12. const size_t & steps,
  13. Eigen::AlignedBox3d & box)
  14. {
  15. using namespace Eigen;
  16. box.setEmpty();
  17. const VectorXd t = VectorXd::LinSpaced(steps,0,1);
  18. // Find extent over all time steps
  19. for(int ti = 0;ti<t.size();ti++)
  20. {
  21. for(size_t vi = 0;vi<n;vi++)
  22. {
  23. box.extend(V(vi,t(ti)).transpose());
  24. }
  25. }
  26. }