libkdegames Library API Documentation

KGrid2D::Square< T > Class Template Reference

This template is a Generic implementation for a square bidimensionnal grid (SquareBase). More...

#include <kgrid2d.h>

Inheritance diagram for KGrid2D::Square< T >:

KGrid2D::Generic< T > KGrid2D::SquareBase List of all members.

Public Member Functions

 Square (uint width=0, uint height=0)
CoordList neighbours (const Coord &c, bool insideOnly=true, bool directOnly=false) const
Coord toEdge (const Coord &c, Neighbour n) const

Detailed Description

template<class T>
class KGrid2D::Square< T >

This template is a Generic implementation for a square bidimensionnal grid (SquareBase).

Since:
3.2

Definition at line 311 of file kgrid2d.h.


Constructor & Destructor Documentation

template<class T>
KGrid2D::Square< T >::Square uint  width = 0,
uint  height = 0
[inline]
 

Constructor.

Definition at line 317 of file kgrid2d.h.


Member Function Documentation

template<class T>
CoordList KGrid2D::Square< T >::neighbours const Coord c,
bool  insideOnly = true,
bool  directOnly = false
const [inline]
 

Returns:
the neighbours of coordinate
Parameters:
c to the given set of coordinates
c the coordinate to use as the reference point
insideOnly only add coordinates that are inside the grid.
directOnly only add the four nearest neighbours.

Definition at line 327 of file kgrid2d.h.

References QValueList::append(), and KGrid2D::Square< T >::neighbours().

Referenced by KGrid2D::Square< T >::neighbours().

template<class T>
Coord KGrid2D::Square< T >::toEdge const Coord c,
Neighbour  n
const [inline]
 

Returns:
the "projection" of the given coordinate on the grid edges.
Parameters:
c the coordinate to use as the reference point
n the direction of projection.

Definition at line 344 of file kgrid2d.h.

References KGrid2D::Generic< T >::height(), KGrid2D::Square< T >::toEdge(), and KGrid2D::Generic< T >::width().

Referenced by KGrid2D::Square< T >::toEdge().


The documentation for this class was generated from the following file:
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 12:49:03 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003