AI_AStar Class Reference
[InExIn]

#include <AI_AStar.h>

List of all members.


Detailed Description

Generic A* (pronounce a-star) algorithm implementation.

Create proprietary Informator class and object and set it to A* object to process some actions such as heuristic or per step optimalization. Add nodes and links. Use session within findWay() method to find shortest way from start node to final node for an abstract agent.

In addition to length links between nodes have minimum and maximum agent's width defined. Only agents that fit into this range can go along the link.

All A* sessions must be destroyed or cleared prior to destroy or clear A* graph.

Version:
1.1 (24.10.2005)
  • Independent sessions finsihed

1.0 Initial release.

Author:
Jindrich Rohlik

Public Types

typedef AI_Array< Link * > LinkArray
 Array of link pointers.
typedef LinkArray::iterator LinkArrayIt
 Iterator to array of link pointers.
typedef AI_Array< Node * > NodeArray
 Array of node pointers.
typedef NodeArray::iterator NodeArrayIt
 Iterator to array of node pointers.

Public Member Functions

 AI_AStar (void)
 Default constructor.
 ~AI_AStar (void)
 Destructor.
NodeaddNode (void *ptr_user_data=NULL)
 Add node into indirected graph.
LinkaddLink (Node *ptr_node1, Node *ptr_node2, float f_lenght, float f_min, float f_max)
 Add link into indirected graph.
void clear (void)
 Destroy all graph data.
void setInformator (Informator *ptr_informator)
 Set informator.
int getLinksNumber (void) const
 Get number of links.
LinkgetLink (int i) const
 Get link.
int getNodesNumber (void) const
 Get number of nodes.
NodegetNode (int i) const
 Get last explored segment.
bool findWay (Session &session)
 Find way from start node to final node with use of given session.

Classes

class  Graph
 Graph as collection of nodes and links and operations over them. More...
class  Informator
class  Link
class  Node
class  Session

Member Typedef Documentation

Array of link pointers.

Iterator to array of link pointers.

Array of node pointers.

Iterator to array of node pointers.


Constructor & Destructor Documentation

AI_AStar::AI_AStar ( void   )  [inline]

Default constructor.

AI_AStar::~AI_AStar ( void   )  [inline]

Destructor.


Member Function Documentation

AI_AStar::Node * AI_AStar::addNode ( void *  ptr_user_data = NULL  )  [inline]

Add node into indirected graph.

AI_AStar::Link * AI_AStar::addLink ( Node ptr_node1,
Node ptr_node2,
float  f_lenght,
float  f_min,
float  f_max 
) [inline]

Add link into indirected graph.

Parameters:
ptr_node1 First node of link.
ptr_node2 Second node of link.
f_lenght Lenght of link.
f_min Minimum width of an agent that could go through this path.
f_max Maximum width of an agent that could go through this path.

void AI_AStar::clear ( void   )  [inline]

Destroy all graph data.

Must be called after all associated sessions were reset.

void AI_AStar::setInformator ( Informator ptr_informator  )  [inline]

Set informator.

int AI_AStar::getLinksNumber ( void   )  const [inline]

Get number of links.

AI_AStar::Link * AI_AStar::getLink ( int  i  )  const [inline]

Get link.

int AI_AStar::getNodesNumber ( void   )  const [inline]

Get number of nodes.

AI_AStar::Node * AI_AStar::getNode ( int  i  )  const [inline]

Get last explored segment.

bool AI_AStar::findWay ( AI_AStar::Session session  ) 

Find way from start node to final node with use of given session.

Way will be stored in session as node sequence from reverse order (from final node to start node).

Parameters:
session All temporary and session unique data are stored in Session object as well as final way.


The documentation for this class was generated from the following files: