GEL
2
GEL is a library for Geometry and Linear Algebra
|
Regular voxel grid. More...
#include <RGrid.h>
Inherits Geometry::AncestorGrid< T, RGrid< T > >.
Public Types | |
typedef T | DataType |
Public Member Functions | |
RGrid (CGLA::Vec3i _dims, const T &val=T()) | |
RGrid () | |
void | store (const CGLA::Vec3i &p, const T &t) |
T & | operator[] (const CGLA::Vec3i &p) |
const T & | operator[] (const CGLA::Vec3i &p) const |
Read only access to voxel grid through const operator[]. | |
const T * | get () const |
Const function to get a pointer to the first voxel in grid. | |
T * | get () |
Non-const function to get a pointer to the first voxel in grid. | |
int | get_x_dim () const |
Get x dimensions of grid. | |
int | get_xy_dim () const |
Get x size times y size of grid. | |
int | get_size () const |
Get length of linear array actually containing voxels. | |
void | clear () |
Regular voxel grid.
This class template can be instantiated and used directly. This is just a regular voxel grid stored as a linear array with functions to access its contents.
Geometry::RGrid< T >::RGrid | ( | CGLA::Vec3i | _dims, |
const T & | val = T() |
||
) | [inline] |
Construct a regular voxel grid. This function is passed a Vec3i _dims and an optional initialization value, val. It creates a grid of specified dimensions, and initializes the value of all voxels to val.
Geometry::RGrid< T >::RGrid | ( | ) | [inline] |
Construct a grid of dimensions 0,0,0
T& Geometry::RGrid< T >::operator[] | ( | const CGLA::Vec3i & | p | ) | [inline] |
Read/write access to voxel grid. This is a non-const overloaded operator[]. In a regular grid, we have reserved room for all voxels in advance. Hence, it is possible to create a non-const operator[]. See AncestorGrid::operator[].
void Geometry::RGrid< T >::store | ( | const CGLA::Vec3i & | p, |
const T & | t | ||
) | [inline] |
Store a voxel in a regular grid.
Reimplemented from Geometry::AncestorGrid< T, RGrid< T > >.