Tracore
Public Member Functions | List of all members
util::Grid Class Reference

#include <Grid.h>

Public Member Functions

 Grid (int width_count, int height_count, double width, double height)
 
 Grid (int width_count, int height_count, int depth_count, double width, double height, double depth)
 
void SetValue (core::ObjectDataPtr value, int x, int y, int z=0)
 
void SetValue (core::ObjectDataPtr value, double x, double y, double z=0)
 
core::ObjectDataPtr GetValue (int x, int y, int z=0) const
 
core::ObjectDataPtr GetValue (double x, double y, double z=0.0) const
 
int GetWidthCount () const
 
int GetHeightCount () const
 
int GetDepthCount () const
 
double GetWidth () const
 
double GetHeight () const
 
double GetDepth () const
 
void PositionToIndex (double x, double y, double z, int &xi, int &yi, int &zi) const
 
void Convolve2D (int vicinity, double *mask, double multiplier)
 
void Convolve2D (util::Filter2D &filter)
 
void Convolve3D (int vicinity, double *mask, double multiplier)
 

Detailed Description

Class for storing values in a three dimensional grid. Can also be used for two dimensions but has a bit overhead.

Constructor & Destructor Documentation

util::Grid::Grid ( int  width_count,
int  height_count,
double  width,
double  height 
)

Creates a new two dimensional grid.

Parameters
width_countThe number of elements on the x axis
height_countThe number of elements on the y axis
widthThe size of the whole grid on the x axis
heightThe size of the whole grid on the y axis
util::Grid::Grid ( int  width_count,
int  height_count,
int  depth_count,
double  width,
double  height,
double  depth 
)

Creates a new three dimensional grid.

Parameters
width_countThe number of elements on the x axis
height_countThe number of elements on the y axis
depth_countThe number of elements on the z axis
widthThe size of the whole grid on the x axis
heightThe size of the whole grid on the y axis
depthThe size of the whole grid on the z axis

Member Function Documentation

void util::Grid::Convolve2D ( int  vicinity,
double *  mask,
double  multiplier 
)

Performs a 2D convolution.

Parameters
vicinityThe size of the mask around the center (a 3x3 mask has a vicinity of 1)
maskThe mask/kernel to use for the convolution
multiplierThe value is multiplied with the result at the end of the convolution
void util::Grid::Convolve2D ( util::Filter2D filter)

Performs a 2D convolution.

Parameters
filterThe 2D filter to use
void util::Grid::Convolve3D ( int  vicinity,
double *  mask,
double  multiplier 
)

Performs a 3D convolution.

Parameters
vicinityThe size of the mask around the center (a 3x3 mask has a vicinity of 1)
maskThe mask/kernel to use for the convolution
multiplierThe value is multiplied with the result at the end of the convolution
double util::Grid::GetDepth ( ) const

Gets the size of the whole grid on the z axis.

Returns
the size of the whole grid on the z axis
int util::Grid::GetDepthCount ( ) const

Gets the number of elements on the z axis.

Returns
The number of elements on the z axis
double util::Grid::GetHeight ( ) const

Gets the size of the whole grid on the y axis.

Returns
the size of the whole grid on the y axis
int util::Grid::GetHeightCount ( ) const

Gets the number of elements on the y axis.

Returns
The number of elements on the y axis
core::ObjectDataPtr util::Grid::GetValue ( int  x,
int  y,
int  z = 0 
) const

Gets the value in the grid cell with the given index.

Parameters
xThe x axis index
yThe y axis index
zThe z axis index
Returns
The value in the grid cell
core::ObjectDataPtr util::Grid::GetValue ( double  x,
double  y,
double  z = 0.0 
) const

Gets the value in the grid cell at the given position.

Parameters
xThe x axis value
yThe y axis value
zThe z axis value
Returns
The value in the grid cell
double util::Grid::GetWidth ( ) const

Gets the size of the whole grid on the x axis.

Returns
the size of the whole grid on the x axis
int util::Grid::GetWidthCount ( ) const

Gets the number of elements on the x axis.

Returns
The number of elements on the x axis
void util::Grid::PositionToIndex ( double  x,
double  y,
double  z,
int &  xi,
int &  yi,
int &  zi 
) const

Converts a 3D position to an 3D index.

Parameters
xThe x axis value
yThe y axis value
zThe z axis value
xiThe x axis index
yiThe y axis index
ziThe z axis index
void util::Grid::SetValue ( core::ObjectDataPtr  value,
int  x,
int  y,
int  z = 0 
)

Sets a value in the grid cell with the given index.

Parameters
valueThe value to set
xThe x axis index
yThe y axis index
zThe z axis index
void util::Grid::SetValue ( core::ObjectDataPtr  value,
double  x,
double  y,
double  z = 0 
)

Sets a value in the grid cell at the given position.

Parameters
valueThe value to set
xThe x axis value
yThe y axis value
zThe z axis value

The documentation for this class was generated from the following files: