91 VoxelGrid(
double size_x,
double size_y,
double size_z,
double resolution,
double origin_x,
double origin_y,
92 double origin_z, T default_object);
120 void resize(
double size_x,
double size_y,
double size_z,
double resolution,
double origin_x,
double origin_y,
121 double origin_z, T default_object);
137 const T&
operator()(
const Eigen::Vector3d& pos)
const;
157 T&
getCell(
const Eigen::Vector3i& pos);
158 const T&
getCell(
int x,
int y,
int z)
const;
159 const T&
getCell(
const Eigen::Vector3i& pos)
const;
179 void setCell(
int x,
int y,
int z,
const T& obj);
180 void setCell(
const Eigen::Vector3i& pos,
const T& obj);
241 void gridToWorld(
int x,
int y,
int z,
double& world_x,
double& world_y,
double& world_z)
const;
242 void gridToWorld(
const Eigen::Vector3i& grid, Eigen::Vector3d& world)
const;
260 bool worldToGrid(
double world_x,
double world_y,
double world_z,
int& x,
int& y,
int& z)
const;
261 bool worldToGrid(
const Eigen::Vector3d& world, Eigen::Vector3i& grid)
const;
273 bool isCellValid(
const Eigen::Vector3i& pos)
const;
308 int ref(
int x,
int y,
int z)
const;
340 double origin_y,
double origin_z, T default_object)
343 resize(size_x, size_y, size_z, resolution, origin_x, origin_y, origin_z, default_object);
365 double origin_y,
double origin_z, T default_object)
460 return getCell(cell_x, cell_y, cell_z);
484 return data_[
ref(pos.x(), pos.y(), pos.z())];
490 return data_[
ref(pos.x(), pos.y(), pos.z())];
502 data_[
ref(pos.x(), pos.y(), pos.z())] = obj;
double size_[3]
The size of each dimension in meters (in Dimension order).
int stride2_
The step to take when stepping between consecutive Y members given an X in the 1D array.
bool worldToGrid(double world_x, double world_y, double world_z, int &x, int &y, int &z) const
Converts from a world location to a set of integer indices. Does check whether or not the cell being ...
VoxelGrid()
Default constructor for the VoxelGrid.
const T & operator()(double x, double y, double z) const
Operator that gets the value of the given location (x, y, z) given the discretization of the volume....
double oo_resolution_
1.0/resolution_
T *** data_ptrs_
3D array of pointers to the data elements
int num_cells_total_
The total number of voxels in the grid.
int getNumCells(Dimension dim) const
Gets the number of cells in the indicated dimension.
int getCellFromLocation(Dimension dim, double loc) const
Gets the cell number from the location.
double origin_minus_[3]
origin - 0.5/resolution
double origin_[3]
The origin (minimum point) of each dimension in meters (in Dimension order).
int stride1_
The step to take when stepping between consecutive X members in the 1D array.
T & getCell(int x, int y, int z)
Gives the value of the given location (x,y,z) in the discretized voxel grid space.
double resolution_
The resolution of each dimension in meters (in Dimension order).
void setCell(int x, int y, int z, const T &obj)
Sets the value of the given location (x,y,z) in the discretized voxel grid space to supplied value.
void reset(const T &initial)
Sets every cell in the voxel grid to the supplied data.
double getLocationFromCell(Dimension dim, int cell) const
Gets the center of the cell in world coordinates along the given dimension. No validity check.
MOVEIT_DECLARE_PTR_MEMBER(VoxelGrid)
int num_cells_[3]
The number of cells in each dimension (in Dimension order).
double getOrigin(Dimension dim) const
Gets the origin (minimum point) of the indicated dimension.
T * data_
Storage for the full set of data elements.
bool isCellValid(int x, int y, int z) const
Checks if the given cell in integer coordinates is within the voxel grid.
T default_object_
The default object to return in case of out-of-bounds query.
double getSize(Dimension dim) const
Gets the size in arbitrary units of the indicated dimension.
int ref(int x, int y, int z) const
Gets the 1D index into the array, with no validity check.
double getResolution() const
Gets the resolution in arbitrary consistent units.
VoxelGrid(double size_x, double size_y, double size_z, double resolution, double origin_x, double origin_y, double origin_z, T default_object)
Constructor for the VoxelGrid.
void resize(double size_x, double size_y, double size_z, double resolution, double origin_x, double origin_y, double origin_z, T default_object)
Resize the VoxelGrid.
void gridToWorld(int x, int y, int z, double &world_x, double &world_y, double &world_z) const
Converts grid coordinates to world coordinates.
Namespace for holding classes that generate distance fields.
Dimension
Specifies dimension of different axes.