Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::Grid< ItemType > Class Template Reference

#include <grid.hpp>

List of all members.


Detailed Description

template<class ItemType>
class Arak::Grid< ItemType >

A grid partitions a rectangular region into rectangular cells of equal height and width.

Each cell is associated with a list of items that can be updated. This class supports linear-time access to all cells that intersect a given line segment, ray, rectangle, or triangle.

Definition at line 18 of file grid.hpp.

Public Types

typedef LineCellIteratorBase<
Grid, Cell
LineCellIterator
 A mutable forwards iterator that ranges over the cells whose closures intersect a given ray or line segment.

typedef LineCellIteratorBase<
const Grid, const Cell
ConstLineCellIterator
 A const forwards iterator that ranges over the cells whose closures intersect a given ray or line segment.

typedef RectangleCellIteratorBase<
Grid, Cell
RectangleCellIterator
 A mutable forwards iterator that ranges over the cells whose closures intersect a given rectangle.

typedef RectangleCellIteratorBase<
const Grid, const Cell
ConstRectangleCellIterator
 A const forwards iterator that ranges over the cells whose closures intersect a given rectangle.

typedef TriangleCellIteratorBase<
Grid, Cell
TriangleCellIterator
 A mutable forwards iterator that ranges over the cells whose closures intersect a given triangle.

typedef TriangleCellIteratorBase<
const Grid, const Cell
ConstTriangleCellIterator
 A const forwards iterator that ranges over the cells whose closures intersect a given triangle.

typedef ConvexPolygonCellIteratorBase<
Grid, Cell
ConvexPolygonCellIterator
 A mutable forwards iterator that ranges over the cells whose closures intersect a given convex polygon.

typedef ConvexPolygonCellIteratorBase<
const Grid, const Cell
ConstConvexPolygonCellIterator
 A const forwards iterator that ranges over the cells whose closures intersect a given convex polygon.


Public Member Functions

 Grid (const Geometry::Rectangle &boundary, int rows, int cols)
 Default constructor.

 ~Grid ()
 Destructor.

int numRows () const
 Returns the number of rows in the grid.

int numCols () const
 Returns the number of columns in the grid.

const Geometry::Rectangleboundary () const
 Returns a const reference to the boundary of the indexed region.

bool getCellCoords (const Geometry::Point &p, int &i, int &j) const
 Updates the supplied parameters to the row and column index of the cell that contains the supplied point.

const CellgetCell (const int i, const int j) const
 Returns a const reference to the cell with the supplied row and column index.

CellgetCell (const int i, const int j)
 Returns a mutable reference to the cell with the supplied row and column index.

const CellgetCell (const Geometry::Point &p) const
 Returns a const reference to the cell that contains the supplied point.

CellgetCell (const Geometry::Point &p)
 Returns a reference to the cell that contains the supplied point.


Protected Attributes

const Geometry::Rectangle bd
 The boundary of the grid.

std::vector< std::vector<
Cell * > > 
cells
 A two-dimensional vector of cells.

const int rows
 The number of rows in the grid.

const int cols
 The number of columns in the grid.

Geometry::Kernel::FT cellWidth
 The (approximate) width of the grid cells.

Geometry::Kernel::FT cellHeight
 The (approximate) height of the grid cells.

std::vector< Geometry::Kernel::FT > xvals
 A vector containing the x values of the (cols + 1) vertical grid lines.

std::vector< Geometry::Kernel::FT > yvals
 A vector containing the y values of the (rows + 1) horizontal grid lines.


Member Typedef Documentation

template<class ItemType>
typedef ConvexPolygonCellIteratorBase<const Grid, const Cell> Arak::Grid< ItemType >::ConstConvexPolygonCellIterator
 

A const forwards iterator that ranges over the cells whose closures intersect a given convex polygon.

Definition at line 970 of file grid.hpp.

template<class ItemType>
typedef LineCellIteratorBase<const Grid, const Cell> Arak::Grid< ItemType >::ConstLineCellIterator
 

A const forwards iterator that ranges over the cells whose closures intersect a given ray or line segment.

Definition at line 519 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::ConvexPolygonCellIteratorBase< GridType, CellType >::ConvexPolygonCellIteratorBase(), and Arak::Grid< ItemType >::TriangleCellIteratorBase< GridType, CellType >::TriangleCellIteratorBase().

template<class ItemType>
typedef RectangleCellIteratorBase<const Grid, const Cell> Arak::Grid< ItemType >::ConstRectangleCellIterator
 

A const forwards iterator that ranges over the cells whose closures intersect a given rectangle.

Definition at line 644 of file grid.hpp.

template<class ItemType>
typedef TriangleCellIteratorBase<const Grid, const Cell> Arak::Grid< ItemType >::ConstTriangleCellIterator
 

A const forwards iterator that ranges over the cells whose closures intersect a given triangle.

Definition at line 804 of file grid.hpp.

template<class ItemType>
typedef ConvexPolygonCellIteratorBase<Grid, Cell> Arak::Grid< ItemType >::ConvexPolygonCellIterator
 

A mutable forwards iterator that ranges over the cells whose closures intersect a given convex polygon.

Definition at line 963 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::ConvexPolygonCellIteratorBase< GridType, CellType >::operator++().

template<class ItemType>
typedef LineCellIteratorBase<Grid, Cell> Arak::Grid< ItemType >::LineCellIterator
 

A mutable forwards iterator that ranges over the cells whose closures intersect a given ray or line segment.

Definition at line 513 of file grid.hpp.

template<class ItemType>
typedef RectangleCellIteratorBase<Grid, Cell> Arak::Grid< ItemType >::RectangleCellIterator
 

A mutable forwards iterator that ranges over the cells whose closures intersect a given rectangle.

Definition at line 637 of file grid.hpp.

template<class ItemType>
typedef TriangleCellIteratorBase<Grid, Cell> Arak::Grid< ItemType >::TriangleCellIterator
 

A mutable forwards iterator that ranges over the cells whose closures intersect a given triangle.

Definition at line 797 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::TriangleCellIteratorBase< GridType, CellType >::operator++().


Constructor & Destructor Documentation

template<class ItemType>
Arak::Grid< ItemType >::Grid const Geometry::Rectangle boundary,
int  rows,
int  cols
[inline]
 

Default constructor.

Parameters:
boundary an axis-aligned rectangle representing the boundary of the grid.
rows the number of rows in the cell grid
cols the number of columns in the cell grid

Definition at line 1034 of file grid.hpp.

template<class ItemType>
Arak::Grid< ItemType >::~Grid  )  [inline]
 

Destructor.

Definition at line 1083 of file grid.hpp.


Member Function Documentation

template<class ItemType>
const Geometry::Rectangle& Arak::Grid< ItemType >::boundary  )  const [inline]
 

Returns a const reference to the boundary of the indexed region.

Returns:
a const reference to the boundary of the indexed region

Definition at line 1108 of file grid.hpp.

Referenced by Arak::ArakPosteriorSonarObs::boundary(), Arak::ArakPosteriorRangeObs::boundary(), Arak::ArakPosteriorRangeObs::retraceObs(), and Arak::GridColorEstimator::write().

template<class ItemType>
Cell& Arak::Grid< ItemType >::getCell const Geometry::Point p  )  [inline]
 

Returns a reference to the cell that contains the supplied point.

Definition at line 1178 of file grid.hpp.

template<class ItemType>
const Cell& Arak::Grid< ItemType >::getCell const Geometry::Point p  )  const [inline]
 

Returns a const reference to the cell that contains the supplied point.

Definition at line 1168 of file grid.hpp.

template<class ItemType>
Cell& Arak::Grid< ItemType >::getCell const int  i,
const int  j
[inline]
 

Returns a mutable reference to the cell with the supplied row and column index.

Parameters:
i the row of the cell
j the column of the cell

Definition at line 1160 of file grid.hpp.

template<class ItemType>
const Cell& Arak::Grid< ItemType >::getCell const int  i,
const int  j
const [inline]
 

Returns a const reference to the cell with the supplied row and column index.

Parameters:
i the row of the cell
j the column of the cell

Definition at line 1149 of file grid.hpp.

Referenced by Arak::Grid< PointColorEstimator * >::getCell(), Arak::GridColorEstimator::GridColorEstimator(), Arak::GridColorEstimator::visualize(), and Arak::GridColorEstimator::write().

template<class ItemType>
bool Arak::Grid< ItemType >::getCellCoords const Geometry::Point p,
int &  i,
int &  j
const [inline]
 

Updates the supplied parameters to the row and column index of the cell that contains the supplied point.

Parameters:
p the point
i updated to the row of the cell containing p
j updated to the column of the cell containing p
Returns:
true if p is in the window (and i and j are valid)

Definition at line 1119 of file grid.hpp.

Referenced by Arak::Grid< PointColorEstimator * >::getCell().

template<class ItemType>
int Arak::Grid< ItemType >::numCols  )  const [inline]
 

Returns the number of columns in the grid.

Returns:
the number of columns in the grid,

Definition at line 1099 of file grid.hpp.

Referenced by Arak::Coloring::read(), Arak::Coloring::readBinary(), Arak::GridColorEstimator::visualize(), and Arak::GridColorEstimator::write().

template<class ItemType>
int Arak::Grid< ItemType >::numRows  )  const [inline]
 

Returns the number of rows in the grid.

Returns:
the number of rows in the grid,

Definition at line 1092 of file grid.hpp.

Referenced by Arak::Coloring::read(), Arak::Coloring::readBinary(), Arak::GridColorEstimator::visualize(), and Arak::GridColorEstimator::write().


Member Data Documentation

template<class ItemType>
const Geometry::Rectangle Arak::Grid< ItemType >::bd [protected]
 

The boundary of the grid.

Definition at line 977 of file grid.hpp.

template<class ItemType>
Geometry::Kernel::FT Arak::Grid< ItemType >::cellHeight [protected]
 

The (approximate) height of the grid cells.

Definition at line 1002 of file grid.hpp.

template<class ItemType>
std::vector< std::vector<Cell*> > Arak::Grid< ItemType >::cells [protected]
 

A two-dimensional vector of cells.

Definition at line 982 of file grid.hpp.

template<class ItemType>
Geometry::Kernel::FT Arak::Grid< ItemType >::cellWidth [protected]
 

The (approximate) width of the grid cells.

Definition at line 997 of file grid.hpp.

template<class ItemType>
const int Arak::Grid< ItemType >::cols [protected]
 

The number of columns in the grid.

Definition at line 992 of file grid.hpp.

template<class ItemType>
const int Arak::Grid< ItemType >::rows [protected]
 

The number of rows in the grid.

Definition at line 987 of file grid.hpp.

template<class ItemType>
std::vector<Geometry::Kernel::FT> Arak::Grid< ItemType >::xvals [protected]
 

A vector containing the x values of the (cols + 1) vertical grid lines.

The first of these is the left boundary of the grid, and the last is the right boundary of the grid. Each grid cell in column j spans the interval $ [ \texttt{xvals[j]}, \texttt{xvals[j + 1]} ) $ except the last column, which is closed on both sides.

Definition at line 1012 of file grid.hpp.

template<class ItemType>
std::vector<Geometry::Kernel::FT> Arak::Grid< ItemType >::yvals [protected]
 

A vector containing the y values of the (rows + 1) horizontal grid lines.

The first of these is the bottom boundary of the grid, and the last is the top boundary of the grid. Each grid cell in row i spans the interval $ [ \texttt{yvals[i]}, \texttt{yvals[i + 1]} ) $ except the last row, which is closed on both sides.

Definition at line 1022 of file grid.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:41:12 2005 for Arak by doxygen 1.3.6