ObjectGrid Class Reference

Object 2D grid. More...

#include <ObjectGrid.hh>

Public Member Functions

 ObjectGrid (int num_x, int num_y, float size_x, float size_y, float size_z)
 Constructor. More...
 
void populate (int num_objects)
 Populates a grid with random objects. More...
 

Public Attributes

std::vector< int > cells
 Array of grid cells. More...
 
float grid_x
 Size of x dimension. More...
 
float grid_y
 Size of y dimension. More...
 
int num_cells_x
 Number of cells in x dimension. More...
 
int num_cells_y
 Number of cells in y dimension. More...
 
float cell_x
 Size of each cell in x dimension. More...
 
float cell_y
 Size of each cell in y dimension. More...
 
float cell_z
 Height of each cell. More...
 
std::vector< Objectobjects
 List of objects in grid. More...
 
int counters [3] = {0}
 Array of counters, one per object type. More...
 
const std::vector< std::string > TYPES = {"sphere", "cylinder","box"}
 Object types string vector. More...
 

Private Member Functions

void addRandomObject (int x, int y)
 Adds a single random object to grid in a given cell. More...
 

Detailed Description

Object 2D grid.

Constructor & Destructor Documentation

ObjectGrid ( int  num_x,
int  num_y,
float  size_x,
float  size_y,
float  size_z 
)

Constructor.

Parameters
num_xNumber of cells in x dimension
num_yNumber of cells in y dimension
size_xSize of grid in x dimension
size_ySize of grid in x dimension
size_zHeight of grid cells (z dimension)

Member Function Documentation

void addRandomObject ( int  x,
int  y 
)
private

Adds a single random object to grid in a given cell.

Parameters
xX coordinate of cell
yY coordinate of cell
void populate ( int  num_objects)

Populates a grid with random objects.

Parameters
num_objectsDesired number of objects

Member Data Documentation

float cell_x

Size of each cell in x dimension.

float cell_y

Size of each cell in y dimension.

float cell_z

Height of each cell.

std::vector<int> cells

Array of grid cells.

int counters[3] = {0}

Array of counters, one per object type.

float grid_x

Size of x dimension.

float grid_y

Size of y dimension.

int num_cells_x

Number of cells in x dimension.

int num_cells_y

Number of cells in y dimension.

std::vector<Object> objects

List of objects in grid.

const std::vector<std::string> TYPES = {"sphere", "cylinder","box"}

Object types string vector.


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