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

PointsWithValidityAndAge Class Reference

Represents a set of points on the field. More...

#include <PointsWithValidityAndAge.h>

List of all members.

Public Types

enum  { MAX_NUMBER_OF_POINTS_WITH_AGE = 600 }
 The maximum number of points in a set. More...

enum  { GRID_SPACING = 50 }
 The space between grid points. More...

enum  { NUMBER_OF_GRID_POINTS_X = (xPosFrontFlags - xPosBackFlags) / GRID_SPACING }
 The number of grid points in x-direction. More...

enum  { NUMBER_OF_GRID_POINTS_Y = (yPosLeftFlags - yPosRightFlags) / GRID_SPACING }
 The number of grid points in y-direction. More...


Public Member Functions

 PointsWithValidityAndAge (short int sizeOfSet)
 Constructor.

 ~PointsWithValidityAndAge ()
 Destructor.

void setSizeOfSet (int size)
 Sets the maximum of points in the set.

void add (int x, int y)
 Adds a point to the set, if necessary an old point is overwritten.

short int getIndexOfNextPoint ()
 Returns the index of the next position in the set, where a point can be added/set.

bool getPositionOfObstacle (int index, int *x_position, int *y_position)
 Gets the position of an obstacle and stores the coordinates in x_position and y_position.

void calculateXYDistribution ()
 Calculates the distribution of points for x and y direction.

void findMaximaInXYDistribution ()
 Finds maxima in the distribution of points for x and y direction.

void voteForHills ()
 Votes for hills in the distribution of points.

int calculateDistance (int x1, int y1, int x2, int y2)
 Calculates the distance of two given points.


Public Attributes

short int x [MAX_NUMBER_OF_POINTS_WITH_AGE]
 The x coordinates of points in the set.

short int y [MAX_NUMBER_OF_POINTS_WITH_AGE]
 The y coordinates of points in the set.

short int numberOfPoints
 The number of points in the set.

short int indexOfNextPoint
 The index of the position in the set where the next point can be stores.

short int sizeOfSet
 The size of the set.

short int xDistribution [NUMBER_OF_GRID_POINTS_X]
 The distribution of points in x direction.

short int yDistribution [NUMBER_OF_GRID_POINTS_Y]
 The distribution of points in y direction.

short int numberOf_xHills
 The number of detected hills in the x distribution.

short int numberOf_yHills
 The number of detected hills in the y distribution.

short int xHills [8]
 The hills (gridposition of hills) in the x distribution.

short int yHills [8]
 The hills (gridposition of hills) in the y distribution.

short int voteHills [8][8]
 All possible hills in the grid, due to the distributions.

short int x_vote [4]
 The x coordinates of the four best votes (generated by voteForHills).

short int y_vote [4]
 The y coordinates of the four best votes (generated by voteForHills).

short int numberOfObstacles
 The number of determined obstacles.


Detailed Description

Represents a set of points on the field.

It is used to determine the location of other players on the field. If a new point is added and there are as many points in the set as it can held, the oldest point is overwritten.

Definition at line 28 of file PointsWithValidityAndAge.h.


Member Enumeration Documentation

anonymous enum
 

The maximum number of points in a set.

Enumeration values:
MAX_NUMBER_OF_POINTS_WITH_AGE 

Definition at line 33 of file PointsWithValidityAndAge.h.

anonymous enum
 

The space between grid points.

Enumeration values:
GRID_SPACING 

Definition at line 35 of file PointsWithValidityAndAge.h.

anonymous enum
 

The number of grid points in x-direction.

Enumeration values:
NUMBER_OF_GRID_POINTS_X 

Definition at line 37 of file PointsWithValidityAndAge.h.

anonymous enum
 

The number of grid points in y-direction.

Enumeration values:
NUMBER_OF_GRID_POINTS_Y 

Definition at line 39 of file PointsWithValidityAndAge.h.


Constructor & Destructor Documentation

PointsWithValidityAndAge::PointsWithValidityAndAge short int  sizeOfSet  ) 
 

Constructor.

Definition at line 53 of file PointsWithValidityAndAge.cpp.

References indexOfNextPoint, NUMBER_OF_GRID_POINTS_X, NUMBER_OF_GRID_POINTS_Y, xDistribution, and yDistribution.

PointsWithValidityAndAge::~PointsWithValidityAndAge  ) 
 

Destructor.

Definition at line 76 of file PointsWithValidityAndAge.cpp.


Member Function Documentation

void PointsWithValidityAndAge::setSizeOfSet int  size  ) 
 

Sets the maximum of points in the set.

Parameters:
size The size of the set

Definition at line 80 of file PointsWithValidityAndAge.cpp.

References sizeOfSet.

void PointsWithValidityAndAge::add int  x,
int  y
 

Adds a point to the set, if necessary an old point is overwritten.

The distributions (in x and y direction) are also updated.

Parameters:
x The x coordinate of the point
y The y coordinate of the point

Definition at line 85 of file PointsWithValidityAndAge.cpp.

References getIndexOfNextPoint(), GRID_SPACING, NUMBER_OF_GRID_POINTS_X, NUMBER_OF_GRID_POINTS_Y, sizeOfSet, xDistribution, and yDistribution.

Here is the call graph for this function:

short int PointsWithValidityAndAge::getIndexOfNextPoint  ) 
 

Returns the index of the next position in the set, where a point can be added/set.

Returns:
The index of the next position

Definition at line 144 of file PointsWithValidityAndAge.cpp.

References indexOfNextPoint, and sizeOfSet.

Referenced by add().

bool PointsWithValidityAndAge::getPositionOfObstacle int  index,
int *  x_position,
int *  y_position
 

Gets the position of an obstacle and stores the coordinates in x_position and y_position.

The parameter index can range from 0 up to 3. If no obstacle with that index exists, the return value is false.

Parameters:
index The index of the obstacle
x_position A pointer to the varible storing the x coordinat
y_position A pointer to the varible storing the y coordinat
Returns:
True, if there is an obstacle at the given index, otherwise false

Definition at line 381 of file PointsWithValidityAndAge.cpp.

void PointsWithValidityAndAge::calculateXYDistribution  ) 
 

Calculates the distribution of points for x and y direction.

Definition at line 156 of file PointsWithValidityAndAge.cpp.

References GRID_SPACING, NUMBER_OF_GRID_POINTS_X, NUMBER_OF_GRID_POINTS_Y, sizeOfSet, xDistribution, and yDistribution.

void PointsWithValidityAndAge::findMaximaInXYDistribution  ) 
 

Finds maxima in the distribution of points for x and y direction.

Definition at line 190 of file PointsWithValidityAndAge.cpp.

References NUMBER_OF_GRID_POINTS_X, NUMBER_OF_GRID_POINTS_Y, numberOf_xHills, numberOf_yHills, xDistribution, xHills, yDistribution, and yHills.

void PointsWithValidityAndAge::voteForHills  ) 
 

Votes for hills in the distribution of points.

The votes are sorted in a ranking, best first

Definition at line 271 of file PointsWithValidityAndAge.cpp.

References calculateDistance(), GRID_SPACING, numberOf_xHills, numberOf_yHills, numberOfObstacles, sizeOfSet, voteHills, x_vote, xHills, y_vote, and yHills.

Here is the call graph for this function:

int PointsWithValidityAndAge::calculateDistance int  x1,
int  y1,
int  x2,
int  y2
 

Calculates the distance of two given points.

Parameters:
x1 The x coordinate of the first point
y1 The y coordinate of the first point
x2 The x coordinate of the second point
y2 The y coordinate of the second point

Definition at line 391 of file PointsWithValidityAndAge.cpp.

Referenced by voteForHills().


Member Data Documentation

short int PointsWithValidityAndAge::x[MAX_NUMBER_OF_POINTS_WITH_AGE]
 

The x coordinates of points in the set.

Definition at line 110 of file PointsWithValidityAndAge.h.

Referenced by operator<<(), and operator>>().

short int PointsWithValidityAndAge::y[MAX_NUMBER_OF_POINTS_WITH_AGE]
 

The y coordinates of points in the set.

Definition at line 112 of file PointsWithValidityAndAge.h.

Referenced by operator<<(), and operator>>().

short int PointsWithValidityAndAge::numberOfPoints
 

The number of points in the set.

Definition at line 114 of file PointsWithValidityAndAge.h.

Referenced by operator<<(), and operator>>().

short int PointsWithValidityAndAge::indexOfNextPoint
 

The index of the position in the set where the next point can be stores.

Definition at line 116 of file PointsWithValidityAndAge.h.

Referenced by getIndexOfNextPoint(), operator<<(), operator>>(), and PointsWithValidityAndAge().

short int PointsWithValidityAndAge::sizeOfSet
 

The size of the set.

Definition at line 118 of file PointsWithValidityAndAge.h.

Referenced by add(), calculateXYDistribution(), getIndexOfNextPoint(), operator<<(), operator>>(), setSizeOfSet(), and voteForHills().

short int PointsWithValidityAndAge::xDistribution[NUMBER_OF_GRID_POINTS_X]
 

The distribution of points in x direction.

Definition at line 123 of file PointsWithValidityAndAge.h.

Referenced by add(), calculateXYDistribution(), findMaximaInXYDistribution(), and PointsWithValidityAndAge().

short int PointsWithValidityAndAge::yDistribution[NUMBER_OF_GRID_POINTS_Y]
 

The distribution of points in y direction.

Definition at line 125 of file PointsWithValidityAndAge.h.

Referenced by add(), calculateXYDistribution(), findMaximaInXYDistribution(), and PointsWithValidityAndAge().

short int PointsWithValidityAndAge::numberOf_xHills
 

The number of detected hills in the x distribution.

Definition at line 127 of file PointsWithValidityAndAge.h.

Referenced by findMaximaInXYDistribution(), and voteForHills().

short int PointsWithValidityAndAge::numberOf_yHills
 

The number of detected hills in the y distribution.

Definition at line 129 of file PointsWithValidityAndAge.h.

Referenced by findMaximaInXYDistribution(), and voteForHills().

short int PointsWithValidityAndAge::xHills[8]
 

The hills (gridposition of hills) in the x distribution.

Definition at line 131 of file PointsWithValidityAndAge.h.

Referenced by findMaximaInXYDistribution(), and voteForHills().

short int PointsWithValidityAndAge::yHills[8]
 

The hills (gridposition of hills) in the y distribution.

Definition at line 133 of file PointsWithValidityAndAge.h.

Referenced by findMaximaInXYDistribution(), and voteForHills().

short int PointsWithValidityAndAge::voteHills[8][8]
 

All possible hills in the grid, due to the distributions.

Definition at line 135 of file PointsWithValidityAndAge.h.

Referenced by voteForHills().

short int PointsWithValidityAndAge::x_vote[4]
 

The x coordinates of the four best votes (generated by voteForHills).

Definition at line 137 of file PointsWithValidityAndAge.h.

Referenced by voteForHills().

short int PointsWithValidityAndAge::y_vote[4]
 

The y coordinates of the four best votes (generated by voteForHills).

Definition at line 139 of file PointsWithValidityAndAge.h.

Referenced by voteForHills().

short int PointsWithValidityAndAge::numberOfObstacles
 

The number of determined obstacles.

Definition at line 142 of file PointsWithValidityAndAge.h.

Referenced by voteForHills().


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 20:10:42 2004 for GT2004 by doxygen 1.3.6