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

Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType > Class Template Reference

#include <grid.hpp>

Collaboration diagram for Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class ItemType>
template<class GridType, class CellType>
class Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >

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

The current implementation performs an orientation test per iteration.

Todo:
Consider implementing Bresenham's Algorithm

Definition at line 235 of file grid.hpp.

Public Member Functions

 LineCellIteratorBase (GridType &g, const Geometry::Point &p, const Geometry::Point &q, SEGMENT)
 Constructor for a cell iterator that travels along a line segment.

 LineCellIteratorBase (GridType &g, const Geometry::Point &p, const Geometry::Point &q, RAY)
 Constructor for a cell iterator that travels along a ray.

 LineCellIteratorBase ()
 Constructor for an end iterator outside the grid.

bool operator== (const LineCellIteratorBase< GridType, CellType > &other) const
 Comparison operators.

bool operator!= (const LineCellIteratorBase< GridType, CellType > &other) const
LineCellIteratorBase< GridType,
CellType > & 
operator++ (int)
 Increment operators.

LineCellIteratorBase< GridType,
CellType > & 
operator++ ()
CellType * operator-> () const
 Accessors.

CellType & operator * () const

Protected Types

enum  CompassDirection {
  NORTH, NORTH_EAST, EAST, SOUTH_EAST,
  SOUTH, SOUTH_WEST, WEST, NORTH_WEST
}
 A categorical direction for rays. More...


Protected Member Functions

CompassDirection direction (const Geometry::Point &p, const Geometry::Point &q)
 Computes the direction of the line from p to q.


Protected Attributes

Geometry::Line line
 The supporting line of the segment or ray that is being traversed.

CompassDirection dir
 The direction of the traversed ray.

CellType * curCell
 The current cell of the iterator.

CellType * lastCell
 The last cell the iterator must visit (or NULL if the iterator should terminate at the boundary of the grid).


Member Enumeration Documentation

template<class ItemType>
template<class GridType, class CellType>
enum Arak::Grid::LineCellIteratorBase::CompassDirection [protected]
 

A categorical direction for rays.

Enumeration values:
NORTH  The ray is vertical and directed upward
NORTH_EAST  The ray is directed into the first quadrant
EAST  The ray is horizontal and directed to the right
SOUTH_EAST  The ray is directed into the fourth quadrant
SOUTH  The ray is vertical and directed downward
SOUTH_WEST  The ray is directed into the third quadrant
WEST  The ray is horizontal and directed to the left
NORTH_WEST  The ray is directed into the second quadrant

Definition at line 247 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::direction().


Constructor & Destructor Documentation

template<class ItemType>
template<class GridType, class CellType>
Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::LineCellIteratorBase GridType &  g,
const Geometry::Point p,
const Geometry::Point q,
SEGMENT 
[inline]
 

Constructor for a cell iterator that travels along a line segment.

Parameters:
g a grid
p a point in the closure of the grid's boundary
q another point in the closure of the grid's boundary

Definition at line 343 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::dir, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::direction(), Arak::intersection(), Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::lastCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::line, Arak::Geometry::Point, and Arak::Geometry::Segment.

template<class ItemType>
template<class GridType, class CellType>
Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::LineCellIteratorBase GridType &  g,
const Geometry::Point p,
const Geometry::Point q,
RAY 
[inline]
 

Constructor for a cell iterator that travels along a ray.

Parameters:
g a grid
p a point giving the source of the ray
q another point, distinct from p, indicating the direction of the ray

Definition at line 375 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::dir, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::direction(), Arak::intersection(), Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::lastCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::line, Arak::Geometry::Point, and Arak::Geometry::Segment.

template<class ItemType>
template<class GridType, class CellType>
Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::LineCellIteratorBase  )  [inline]
 

Constructor for an end iterator outside the grid.

Definition at line 402 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::lastCell, and Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::line.


Member Function Documentation

template<class ItemType>
template<class GridType, class CellType>
CompassDirection Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::direction const Geometry::Point p,
const Geometry::Point q
[inline, protected]
 

Computes the direction of the line from p to q.

Parameters:
p a point
q a point distinct from p
Returns:
the direction of the line directed from p to q

Definition at line 281 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::CompassDirection, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH_EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH_WEST, Arak::Geometry::Point, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH_EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH_WEST, and Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::WEST.

Referenced by Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::LineCellIteratorBase().

template<class ItemType>
template<class GridType, class CellType>
CellType& Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator *  )  const [inline]
 

Definition at line 505 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell.

template<class ItemType>
template<class GridType, class CellType>
bool Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator!= const LineCellIteratorBase< GridType, CellType > &  other  )  const [inline]
 

Definition at line 414 of file grid.hpp.

template<class ItemType>
template<class GridType, class CellType>
LineCellIteratorBase<GridType,CellType>& Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator++  )  [inline]
 

Definition at line 425 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::dir, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::lastCell, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::line, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH_EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::NORTH_WEST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH_EAST, Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::SOUTH_WEST, and Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::WEST.

template<class ItemType>
template<class GridType, class CellType>
LineCellIteratorBase<GridType,CellType>& Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator++ int   )  [inline]
 

Increment operators.

Definition at line 420 of file grid.hpp.

template<class ItemType>
template<class GridType, class CellType>
CellType* Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator->  )  const [inline]
 

Accessors.

Definition at line 504 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell.

template<class ItemType>
template<class GridType, class CellType>
bool Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator== const LineCellIteratorBase< GridType, CellType > &  other  )  const [inline]
 

Comparison operators.

Definition at line 411 of file grid.hpp.

References Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell.


Member Data Documentation

template<class ItemType>
template<class GridType, class CellType>
CellType* Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::curCell [protected]
 

The current cell of the iterator.

Definition at line 266 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::LineCellIteratorBase(), Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator *(), Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator++(), Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator->(), and Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::operator==().

template<class ItemType>
template<class GridType, class CellType>
CompassDirection Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::dir [protected]
 

The direction of the traversed ray.

Definition at line 261 of file grid.hpp.

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

template<class ItemType>
template<class GridType, class CellType>
CellType* Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::lastCell [protected]
 

The last cell the iterator must visit (or NULL if the iterator should terminate at the boundary of the grid).

Definition at line 272 of file grid.hpp.

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

template<class ItemType>
template<class GridType, class CellType>
Geometry::Line Arak::Grid< ItemType >::LineCellIteratorBase< GridType, CellType >::line [protected]
 

The supporting line of the segment or ray that is being traversed.

Definition at line 242 of file grid.hpp.

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


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