swept_volume_bounding_box.cpp 884 B

12345678910111213141516171819202122232425262728
  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. #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. using namespace Eigen;
  17. box.setEmpty();
  18. const VectorXd t = igl::LinSpaced<VectorXd >(steps,0,1);
  19. // Find extent over all time steps
  20. for(int ti = 0;ti<t.size();ti++)
  21. {
  22. for(size_t vi = 0;vi<n;vi++)
  23. {
  24. box.extend(V(vi,t(ti)).transpose());
  25. }
  26. }
  27. }