voxel_grid.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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_VOXEL_GRID_H
  9. #define IGL_VOXEL_GRID_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Geometry>
  13. namespace igl
  14. {
  15. // Construct the cell center positions of a regular voxel grid (lattice) made
  16. // of perfectly square voxels.
  17. //
  18. // Inputs:
  19. // box bounding box to enclose by grid
  20. // s number of cell centers on largest side (including 2*pad_count)
  21. // pad_count number of cells beyond box
  22. // Outputs:
  23. // GV side(0)*side(1)*side(2) by 3 list of cell center positions
  24. // side 3-long list of dimension of voxel grid
  25. IGL_INLINE void voxel_grid(
  26. const Eigen::AlignedBox3d & box,
  27. const int s,
  28. const int pad_count,
  29. Eigen::MatrixXd & GV,
  30. Eigen::RowVector3i & side);
  31. }
  32. #ifndef IGL_STATIC_LIBRARY
  33. # include "voxel_grid.cpp"
  34. #endif
  35. #endif