#include <PointsWithValidityAndAge.h>
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. |
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.
|
The maximum number of points in a set.
Definition at line 33 of file PointsWithValidityAndAge.h. |
|
The space between grid points.
Definition at line 35 of file PointsWithValidityAndAge.h. |
|
The number of grid points in x-direction.
Definition at line 37 of file PointsWithValidityAndAge.h. |
|
The number of grid points in y-direction.
Definition at line 39 of file PointsWithValidityAndAge.h. |
|
Constructor.
Definition at line 53 of file PointsWithValidityAndAge.cpp. References indexOfNextPoint, NUMBER_OF_GRID_POINTS_X, NUMBER_OF_GRID_POINTS_Y, xDistribution, and yDistribution. |
|
Destructor.
Definition at line 76 of file PointsWithValidityAndAge.cpp. |
|
Sets the maximum of points in the set.
Definition at line 80 of file PointsWithValidityAndAge.cpp. References sizeOfSet. |
|
Adds a point to the set, if necessary an old point is overwritten. The distributions (in x and y direction) are also updated.
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:
|
Returns the index of the next position in the set, where a point can be added/set.
Definition at line 144 of file PointsWithValidityAndAge.cpp. References indexOfNextPoint, and sizeOfSet. Referenced by add(). |
|
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.
Definition at line 381 of file PointsWithValidityAndAge.cpp. |
|
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. |
|
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. |
|
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:
|
Calculates the distance of two given points.
Definition at line 391 of file PointsWithValidityAndAge.cpp. Referenced by voteForHills(). |
|
The x coordinates of points in the set.
Definition at line 110 of file PointsWithValidityAndAge.h. Referenced by operator<<(), and operator>>(). |
|
The y coordinates of points in the set.
Definition at line 112 of file PointsWithValidityAndAge.h. Referenced by operator<<(), and operator>>(). |
|
The number of points in the set.
Definition at line 114 of file PointsWithValidityAndAge.h. Referenced by operator<<(), and operator>>(). |
|
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(). |
|
The size of the set.
Definition at line 118 of file PointsWithValidityAndAge.h. Referenced by add(), calculateXYDistribution(), getIndexOfNextPoint(), operator<<(), operator>>(), setSizeOfSet(), and voteForHills(). |
|
The distribution of points in x direction.
Definition at line 123 of file PointsWithValidityAndAge.h. Referenced by add(), calculateXYDistribution(), findMaximaInXYDistribution(), and PointsWithValidityAndAge(). |
|
The distribution of points in y direction.
Definition at line 125 of file PointsWithValidityAndAge.h. Referenced by add(), calculateXYDistribution(), findMaximaInXYDistribution(), and PointsWithValidityAndAge(). |
|
The number of detected hills in the x distribution.
Definition at line 127 of file PointsWithValidityAndAge.h. Referenced by findMaximaInXYDistribution(), and voteForHills(). |
|
The number of detected hills in the y distribution.
Definition at line 129 of file PointsWithValidityAndAge.h. Referenced by findMaximaInXYDistribution(), and voteForHills(). |
|
The hills (gridposition of hills) in the x distribution.
Definition at line 131 of file PointsWithValidityAndAge.h. Referenced by findMaximaInXYDistribution(), and voteForHills(). |
|
The hills (gridposition of hills) in the y distribution.
Definition at line 133 of file PointsWithValidityAndAge.h. Referenced by findMaximaInXYDistribution(), and voteForHills(). |
|
All possible hills in the grid, due to the distributions.
Definition at line 135 of file PointsWithValidityAndAge.h. Referenced by voteForHills(). |
|
The x coordinates of the four best votes (generated by voteForHills).
Definition at line 137 of file PointsWithValidityAndAge.h. Referenced by voteForHills(). |
|
The y coordinates of the four best votes (generated by voteForHills).
Definition at line 139 of file PointsWithValidityAndAge.h. Referenced by voteForHills(). |
|
The number of determined obstacles.
Definition at line 142 of file PointsWithValidityAndAge.h. Referenced by voteForHills(). |