libnxter  0.1
Data Structures | Functions
Map.nxc File Reference

A 2D map implementation that holds a set of landmark objects. More...

#include "Screen.nxc"
#include "Angle.nxc"
#include "Vector.nxc"
Include dependency graph for Map.nxc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Map
 Map class to hold a collection of landmarks. More...
 

Functions

void MapArrayLandmarks (Map &map, long &landmarks[])
 Initializes the Map with an array of landmarks. The array has alternate x and y positions of the landmarks.
 
void MapAddLandMark (Map &map, int x, int y)
 Adds a landmark (x,y) to the map.
 
int MapGetNumLandmarks (Map &map)
 Returns the number of landmarks currently present in the map.
 
void MapGetLandmark (Map &map, int index, Vector &vec)
 Gets a landmark at the given index and returns it in the provide vector.
 
bool MapFindNearestLandmarkAtAngle (Map &map, Vector &reference, int minAngle, int maxAngle, Vector &retLandmark)
 Finds the nearest landmark around the reference vector within the bounds of given minAngle and maxAngle from the reference vector. More...
 
bool MapFindTriangulationLandmarks (Map &map, Vector &reference, int minAngle, int maxAngle, Vector &landmark1, Vector &landmark2)
 Finds two nearest landmarks around the reference vector within the bounds of given minAngle and maxAngle from the reference vector, that can be used for location triangulation. More...
 
bool MapFindNearestLandmark (Map &map, Vector &reference, Vector &retLandmark)
 Finds the nearest landmard around the reference vector. More...
 

Detailed Description

A 2D map implementation that holds a set of landmark objects.

Definition in file Map.nxc.

Function Documentation

bool MapFindNearestLandmark ( Map map,
Vector reference,
Vector retLandmark 
)

Finds the nearest landmard around the reference vector.

If a landmark is found, returns true and retLandmark is set, otherwise false is returned and retLandmark is not set.

Definition at line 198 of file Map.nxc.

References MapGetLandmark(), MapGetNumLandmarks(), VectorGetDistance(), and VectorSubtract().

bool MapFindNearestLandmarkAtAngle ( Map map,
Vector reference,
int  minAngle,
int  maxAngle,
Vector retLandmark 
)

Finds the nearest landmark around the reference vector within the bounds of given minAngle and maxAngle from the reference vector.

If a landmark is found, returns true and retLandmark is set, otherwise false is returned and retLandmark is not set. minAngle is angle bound on the right side of the search, and maxAngle is angle bound on the left side (because angle increses on anti-clockwise). minAngle and maxAngle values have nothing to do with their numerical min or max values, but rather refers to their orientation in the plane. minAngle and maxAngle are abosulute angle on the map (0 .. 360) and theta component in the referece vector is not used.

Definition at line 93 of file Map.nxc.

References MapGetLandmark(), MapGetNumLandmarks(), VectorGetAngleVec(), VectorGetDistanceVec(), and VectorSubtract().

Referenced by MapFindTriangulationLandmarks().

bool MapFindTriangulationLandmarks ( Map map,
Vector reference,
int  minAngle,
int  maxAngle,
Vector landmark1,
Vector landmark2 
)

Finds two nearest landmarks around the reference vector within the bounds of given minAngle and maxAngle from the reference vector, that can be used for location triangulation.

If suitable landmarks are found, returns true and landmark1 and landmark2 are set, otherwise false is returned and the vectors are not set.

Definition at line 141 of file Map.nxc.

References AngleAbsAdd(), AngleAbsSub(), and MapFindNearestLandmarkAtAngle().