19#ifndef HEADER_DRIVE_NODE_HPP
20#define HEADER_DRIVE_NODE_HPP
24#include "tracks/quad.hpp"
72 typedef std::vector<int> PathToNodeVector;
107 unsigned int node_index,
bool invisible,
108 bool ai_ignore,
bool ignored);
116 void setChecklineRequirements(
int latest_checkline);
118 void setDirectionData(
unsigned int successor,
DirectionType dir,
119 unsigned int last_node_index);
185 unsigned int *last)
const
196 virtual void getDistances(
const Vec3 &xyz,
Vec3 *result)
const = 0;
This class stores a node of the drive graph, i.e.
Definition: drive_node.hpp:32
const Vec3 & getUpperCenter() const
Returns the center point of the upper edge of this drive node.
Definition: drive_node.hpp:160
float m_width
Width of the track, which is the average of the width at the beginning and at the end.
Definition: drive_node.hpp:67
float getDistanceToSuccessor(unsigned int j) const
Returns the distance to the j-th.
Definition: drive_node.hpp:139
Vec3 m_lower_center
Lower center point of the drive node.
Definition: drive_node.hpp:41
bool m_ai_ignore
Set to true if this drive node should not be used by the AI.
Definition: drive_node.hpp:51
float m_distance_from_start
Distance from the start to the beginning of the drive node.
Definition: drive_node.hpp:47
const Vec3 & getRightUnitVector() const
Returns a unit vector pointing to the right side of the quad.
Definition: drive_node.hpp:191
unsigned int getSuccessor(unsigned int i) const
Returns the i-th successor node.
Definition: drive_node.hpp:126
PathToNodeVector m_path_to_node
This vector is only used if the drive node has more than one successor.
Definition: drive_node.hpp:77
const std::vector< int > & getChecklineRequirements() const
Returns the checkline requirements of this drive node.
Definition: drive_node.hpp:180
float getAngleToSuccessor(unsigned int j) const
Returns the angle from this node to the j-th.
Definition: drive_node.hpp:143
Vec3 m_center_to_right
A vector from the center of the quad to the right edge.
Definition: drive_node.hpp:70
std::vector< unsigned int > m_last_index_same_direction
Stores for each successor the index of the last drive node that has the same direction (i....
Definition: drive_node.hpp:86
Vec3 m_upper_center
Upper center point of the drive node.
Definition: drive_node.hpp:44
std::vector< int > m_predecessor_nodes
The list of predecessors of a node.
Definition: drive_node.hpp:57
std::vector< DirectionType > m_direction
The direction for each of the successors.
Definition: drive_node.hpp:80
bool letAIIgnore() const
True if this node should be ignored by the AI.
Definition: drive_node.hpp:194
int getPredecessor(unsigned int i) const
Returns a predecessor for this node.
Definition: drive_node.hpp:136
void addSuccessor(unsigned int to)
Adds a successor to a node.
Definition: drive_node.cpp:67
std::vector< int > m_checkline_requirements
Sets of checklines you should have activated when you are driving on this node (there is a possibilit...
Definition: drive_node.hpp:97
bool ignoreSuccessorForAI(unsigned int i) const
Returns true if the index-successor of this node is one that the AI is allowed to use.
Definition: drive_node.cpp:176
float getDistanceFromStart() const
Returns the distance from start.
Definition: drive_node.hpp:147
float getPathWidth() const
Returns the width of the part for this quad.
Definition: drive_node.hpp:154
float getNodeLength() const
Returns the length of the quad of this node.
Definition: drive_node.hpp:163
DirectionType
To indiciate in which direction the track is going: straight, left, right.
Definition: drive_node.hpp:37
std::vector< float > m_angle_to_next
The angle of the line from this node to each neighbour.
Definition: drive_node.hpp:63
unsigned int getNumberOfPredecessors() const
Returns the number of predecessors.
Definition: drive_node.hpp:130
void markAllSuccessorsToUse(unsigned int n, PathToNodeVector *m_path_to_node)
This function marks that the successor n should be used to reach this node.
Definition: drive_node.cpp:138
void getDirectionData(unsigned int succ, DirectionType *dir, unsigned int *last) const
Returns the direction in which the successor n is.
Definition: drive_node.hpp:184
std::vector< int > m_successor_nodes
The list of successor drive nodes.
Definition: drive_node.hpp:54
void setupPathsToNode()
If this node has more than one successor, it will set up a vector that contains the direction to use ...
Definition: drive_node.cpp:92
unsigned int getNumberOfSuccessors() const
Returns the number of successors.
Definition: drive_node.hpp:122
void setDistanceFromStart(float d)
Sets the distance from start for this node.
Definition: drive_node.hpp:151
Vec3 m_right_unit_vector
A unit vector pointing from the center to the right side, orthogonal to the driving direction.
Definition: drive_node.hpp:90
const Vec3 & getLowerCenter() const
Returns the center point of the lower edge of this drive node.
Definition: drive_node.hpp:157
int getSuccessorToReach(unsigned int n)
Returns which successor node to use in order to be able to reach the given node n.
Definition: drive_node.hpp:172
std::vector< float > m_distance_to_next
The distance to each of the successors.
Definition: drive_node.hpp:60
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35