INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydroogmap::GenericMap< T > Class Template Reference

#include <genericmap.h>

List of all members.

Public Member Functions

int numCellsX () const
 Returns the number of cells along the x-axis.
int numCellsY () const
 Returns the number of cells along the y-axis.
int numCells () const
 Returns the total number of cells.
double worldSizeX () const
 Returns the size of the world, in metres, along the x-axis.
double worldSizeY () const
 Returns the size of the world, in metres, along the y-axis.
Frame2d & offset ()
 Set the offset (global coordinates of the bottom-left corner of the bottom-left cell).
const Frame2d & offset () const
 Get the offset (global coordinates of the bottom-left corner of the bottom-left cell).
void setMetresPerCell (double mPerCell)
 Set the size of each cell.
double metresPerCell () const
 get the size of each cell
T * data ()
 Set values.
const T * data () const
 Get values.
const std::vector< T > & dataVec () const
 Get values as a vector.
double worldXCoord (int gridX) const
double worldYCoord (int gridY) const
void getWorldCoords (int gridX, int gridY, double &worldX, double &worldY) const
WorldCoords worldCoords (const GridIndices &gridIndices) const
void getCellIndices (double worldX, double worldY, int &gridX, int &gridY) const
T & gridCell (int indX, int indY)
const T & gridCell (int indX, int indY) const
T & gridCell (const GridIndices &gridIndices)
const T & gridCell (const GridIndices &gridIndices) const
T & worldCell (double worldX, double worldY)
const T & worldCell (double worldX, double worldY) const
T & worldCell (const WorldCoords &worldCoords)
const T & worldCell (const WorldCoords &worldCoords) const
bool tryGridCell (int indX, int indY, T &cell) const
 Tries to get a cell (bounds check performed). Returns TRUE if successful, FALSE if the cell is outside the map.
bool tryWorldCell (double worldX, double worldY, T &cell) const
 Tries to get a cell (bounds check performed). Returns TRUE if successful, FALSE if the cell is outside the map.
bool tryGridCell (const GridIndices &indices, T &cell) const
 Tries to get a cell (bounds check performed). Returns TRUE if successful, FALSE if the cell is outside the map.
bool tryWorldCell (const WorldCoords &worldCoords, T &cell) const
 Tries to get a cell (bounds check performed). Returns TRUE if successful, FALSE if the cell is outside the map.
int worldToIndexX (double worldX) const
 translate a world coord to a map coord
void reallocate (int numCellsX, int numCellsY)
 Change the size of the map.
void fill (const T &cellValue)
 Fill the map with the given value.
bool coordsWithinMap (double worldX, double worldY) const
 Are the world coordinates within the map?
bool coordsWithinMap (const WorldCoords &worldCoords) const
 Are the world coordinates within the map?
bool cellWithinMap (int gridX, int gridY) const
 Is the grid cell within the map?
bool cellWithinMap (const GridIndices &gridIndices) const
 Is the grid cell within the map?

Detailed Description

template<typename T>
class hydroogmap::GenericMap< T >

A (spatial) map of values: posit a 2D grid of cells over the world, with a value stored at each cell.

There are conceptually two coordinate systems:

1) The global continuous coordinate system. 2) The discrete grid-based coordinate system.

In addition:

3) The array of cells can be indexed by a single integer.

The three methods of referring to cells are defined as follows:

     1) GLOBAL COORDINATE SYSTEM              2) CELL INDEXING                 3) DATA STORAGE
         worldCoords(double,double)            gridIndices(int,int)            e.g. OgMapData->data(index)
           _________________                   _________________                _________________
          |                 |     numCellsY-1 |  ^              |              |                 | 
 world    |                 |         ^       |  |              |              |                 | 
 y-axis   |                 |         .       |  |              |              |                 |
   ^      |                 |         . indY  |  |worldSizeY    |              |                 |
   |      |                 |         .       |  |              |              |                 |
   |      |                 |         .       |  |  worldSizeX  |              |----> index      |
   |  oX  |                 |         .       |<-|------------->|              |---------------->|
   |----->|_________________|         0       |__v______________|              |_________________|
   |      ^                                  
   |      | oY       world                             indX                   index: 0 -> sizeX * sizeY - 1
   |______|_____>    x-axis                    0 - - - - - - -> numCellsX-1

   (oX = offset.p.x, oY = offset.p.y)

   (note: in (1), the map is aligned with the world axes.  This need not be the case.)

Member Function Documentation

template<typename T>
void hydroogmap::GenericMap< T >::getCellIndices ( double  worldX,
double  worldY,
int &  gridX,
int &  gridY 
) const [inline]

Get the grid cell indices of a point in the world worldX and worldY don't have to be within the map bounds.

template<typename T>
void hydroogmap::GenericMap< T >::getWorldCoords ( int  gridX,
int  gridY,
double &  worldX,
double &  worldY 
) const [inline]

Get the world coordinates of a grid cell. (Returns the coords of the centre of the cell) gridX and gridY don't have to be within the map bounds.

template<typename T>
const T& hydroogmap::GenericMap< T >::gridCell ( const GridIndices gridIndices  )  const [inline]

Get a cell, indexed by map coords (no bounds checking is performed)

template<typename T>
T& hydroogmap::GenericMap< T >::gridCell ( const GridIndices gridIndices  )  [inline]

Set a cell indexed by map coords (no bounds checking is performed)

template<typename T>
const T& hydroogmap::GenericMap< T >::gridCell ( int  indX,
int  indY 
) const [inline]

Get a cell, indexed by map coords (no bounds checking is performed)

Referenced by hydroogmap::GenericMap< double >::gridCell().

template<typename T>
T& hydroogmap::GenericMap< T >::gridCell ( int  indX,
int  indY 
) [inline]

Get a cell-reference, indexed by map coords (no bounds checking is performed)

Referenced by hydroogmap::GenericMap< double >::gridCell().

template<typename T>
const T& hydroogmap::GenericMap< T >::worldCell ( const WorldCoords worldCoords  )  const [inline]

Get a cell, indexed by world coords (no bounds checking is performed)

template<typename T>
T& hydroogmap::GenericMap< T >::worldCell ( const WorldCoords worldCoords  )  [inline]

Set a cell indexed by world coords (no bounds checking is performed)

template<typename T>
const T& hydroogmap::GenericMap< T >::worldCell ( double  worldX,
double  worldY 
) const [inline]

Get a cell, indexed by world coords (no bounds checking is performed)

Referenced by hydroogmap::GenericMap< double >::worldCell().

template<typename T>
T& hydroogmap::GenericMap< T >::worldCell ( double  worldX,
double  worldY 
) [inline]

Set a cell indexed by world coords (no bounds checking is performed)

Referenced by hydrosim2d::VehicleSimulator::isCollided(), and hydroogmap::GenericMap< double >::worldCell().

template<typename T>
WorldCoords hydroogmap::GenericMap< T >::worldCoords ( const GridIndices gridIndices  )  const [inline]

Get the world coordinates of a grid cell. (Returns the coords of the centre of the cell) gridX and gridY don't have to be within the map bounds.

Referenced by hydroogmap::OgLosTracer::isClearWorld().

template<typename T>
double hydroogmap::GenericMap< T >::worldXCoord ( int  gridX  )  const [inline]

Get the x world coord of a grid cell. (Returns the coords of the centre of the cell) gridX doesn't have to be within the map bounds.

template<typename T>
double hydroogmap::GenericMap< T >::worldYCoord ( int  gridY  )  const [inline]

Get the y world coord of a grid cell. (Returns the coords of the centre of the cell) gridY doesn't have to be within the map bounds.


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

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5