libkdegames Library API Documentation

KGrid2D::Hexagonal< Type > Class Template Reference

This template implements a hexagonal grid where hexagons form horizontal lines:
 (0,0)   (0,1)   (0,2)
     (1,0)   (1,1)   (1,2)
 (2,0)   (2,1)   (2,2)
 
. More...

#include <kgrid2d.h>

Inheritance diagram for KGrid2D::Hexagonal< Type >:

KGrid2D::Generic< Type > KGrid2D::HexagonalBase List of all members.

Public Methods

 Hexagonal (uint width=0, uint height=0)
CoordList neighbours (const Coord &c, bool insideOnly=true) const
CoordList neighbours (const Coord &c, uint distance, bool all, bool insideOnly=true) const

Detailed Description

template<class Type>
class KGrid2D::Hexagonal< Type >

This template implements a hexagonal grid where hexagons form horizontal lines:
 (0,0)   (0,1)   (0,2)
     (1,0)   (1,1)   (1,2)
 (2,0)   (2,1)   (2,2)
 
.

@ since 3.2

Definition at line 451 of file kgrid2d.h.


Constructor & Destructor Documentation

template<class Type>
KGrid2D::Hexagonal< Type >::Hexagonal uint    width = 0,
uint    height = 0
[inline]
 

Constructor.

Definition at line 457 of file kgrid2d.h.

References KGrid2D::Generic< Type >::height(), and KGrid2D::Generic< Type >::width().


Member Function Documentation

template<class Type>
CoordList KGrid2D::Hexagonal< Type >::neighbours const Coord &    c,
bool    insideOnly = true
const [inline]
 

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

Definition at line 466 of file kgrid2d.h.

References QValueList::append(), KGrid2D::HexagonalBase::Neighbour, and KGrid2D::HexagonalBase::neighbour().

Referenced by KGrid2D::Hexagonal< Type >::neighbours().

template<class Type>
CoordList KGrid2D::Hexagonal< Type >::neighbours const Coord &    c,
uint    distance,
bool    all,
bool    insideOnly = true
const [inline]
 

Returns:
the neighbours at distance
Parameters:
distance  of coordinate
c  the coordinate to use as the reference point
distance  distance to the neighbour (1 means at contact).
insideOnly  only add coordinates that are inside the grid.
all  returns all neighbours at distance equal and less than
distance  (the original coordinate is not included).

Definition at line 485 of file kgrid2d.h.

References QValueList::append(), QValueList::begin(), KGrid2D::HexagonalBase::distance(), QValueList::end(), QValueList::find(), KGrid2D::Hexagonal< Type >::neighbours(), and QValueList::remove().


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.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 10:06:40 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003