swept_volume_bounding_box.cpp 873 B

123456789101112131415161718192021222324252627
  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. #include "swept_volume_bounding_box.h"
  9. #include "LinSpaced.h"
  10. IGL_INLINE void igl::swept_volume_bounding_box(
  11. const size_t & n,
  12. const std::function<Eigen::RowVector3d(const size_t vi, const double t)> & V,
  13. const size_t & steps,
  14. Eigen::AlignedBox3d & box)
  15. {
  16. box.setEmpty();
  17. const Eigen::VectorXd t = igl::LinSpaced<Eigen::VectorXd >(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. }