voxel_grid.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. template <
  26. typename Scalar,
  27. typename DerivedGV,
  28. typename Derivedside>
  29. IGL_INLINE void voxel_grid(
  30. const Eigen::AlignedBox<Scalar,3> & box,
  31. const int s,
  32. const int pad_count,
  33. Eigen::PlainObjectBase<DerivedGV> & GV,
  34. Eigen::PlainObjectBase<Derivedside> & side);
  35. }
  36. #ifndef IGL_STATIC_LIBRARY
  37. # include "voxel_grid.cpp"
  38. #endif
  39. #endif