SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
DriveNode2D Class Reference
Inheritance diagram for DriveNode2D:
Inheritance graph
[legend]

Public Member Functions

 DriveNode2D (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3, const Vec3 &normal, unsigned int node_index, bool invisible, bool ai_ignore, bool ignored)
 
virtual void getDistances (const Vec3 &xyz, Vec3 *result) const OVERRIDE
 Returns the distance a point has from this node in forward and sidewards direction, i.e.
 
virtual float getDistance2FromPoint (const Vec3 &xyz) const OVERRIDE
 Returns the square of the distance between the given point and any point on the 'centre' line, i.e.
 
- Public Member Functions inherited from DriveNode
 DriveNode (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3, const Vec3 &normal, unsigned int node_index, bool invisible, bool ai_ignore, bool ignored)
 
void addSuccessor (unsigned int to)
 Adds a successor to a node.
 
void setupPathsToNode ()
 If this node has more than one successor, it will set up a vector that contains the direction to use when a certain drive node X should be reached.
 
void setChecklineRequirements (int latest_checkline)
 
void setDirectionData (unsigned int successor, DirectionType dir, unsigned int last_node_index)
 
unsigned int getNumberOfSuccessors () const
 Returns the number of successors.
 
unsigned int getSuccessor (unsigned int i) const
 Returns the i-th successor node.
 
unsigned int getNumberOfPredecessors () const
 Returns the number of predecessors.
 
int getPredecessor (unsigned int i) const
 Returns a predecessor for this node.
 
float getDistanceToSuccessor (unsigned int j) const
 Returns the distance to the j-th.
 
float getAngleToSuccessor (unsigned int j) const
 Returns the angle from this node to the j-th.
 
float getDistanceFromStart () const
 Returns the distance from start.
 
void setDistanceFromStart (float d)
 Sets the distance from start for this node.
 
float getPathWidth () const
 Returns the width of the part for this quad.
 
const Vec3getLowerCenter () const
 Returns the center point of the lower edge of this drive node.
 
const Vec3getUpperCenter () const
 Returns the center point of the upper edge of this drive node.
 
float getNodeLength () const
 Returns the length of the quad of this node.
 
bool ignoreSuccessorForAI (unsigned int i) const
 Returns true if the index-successor of this node is one that the AI is allowed to use.
 
int getSuccessorToReach (unsigned int n)
 Returns which successor node to use in order to be able to reach the given node n.
 
const std::vector< int > & getChecklineRequirements () const
 Returns the checkline requirements of this drive node.
 
void getDirectionData (unsigned int succ, DirectionType *dir, unsigned int *last) const
 Returns the direction in which the successor n is.
 
const Vec3getRightUnitVector () const
 Returns a unit vector pointing to the right side of the quad.
 
bool letAIIgnore () const
 True if this node should be ignored by the AI.
 
virtual void getDistances (const Vec3 &xyz, Vec3 *result) const =0
 
- Public Member Functions inherited from Quad
 Quad (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3, const Vec3 &normal=Vec3(0, 1, 0), int index=-1, bool invisible=false, bool ignored=false)
 Constructor, takes 4 points.
 
void getVertices (video::S3DVertex *v, const video::SColor &color) const
 Sets the vertices in a irrlicht vertex array to the 4 points of this quad.
 
void getSPMVertices (video::S3DVertexSkinnedMesh *v, const video::SColor &color) const
 Sets the vertices in an spm vertex array to the 4 points of this quad.
 
const Vec3operator[] (int i) const
 Returns the i-th.
 
const Vec3getCenter () const
 Returns the center of a quad.
 
void setQuad (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3)
 Set new quad coordinates.
 
void setHeightTesting (float min, float max)
 
float getMinHeight () const
 Returns the minimum height of a quad.
 
int getIndex () const
 Returns the index of this quad.
 
bool isInvisible () const
 Returns true of this quad is invisible, i.e.
 
bool isIgnored () const
 
const Vec3getNormal () const
 Returns the normal of this quad.
 
virtual bool pointInside (const Vec3 &p, bool ignore_vertical=false) const
 Returns true if a point is inside this quad.
 
virtual bool is3DQuad () const
 Returns true if this quad is 3D, which additional 3D testing is used in pointInside.
 
virtual float getDistance2FromPoint (const Vec3 &xyz) const
 

Private Attributes

core::vector2df m_lower_center_2d
 The center point of the lower two points (e.g.
 
core::line2df m_line
 Line between lower and upper center, saves computation in getDistance() later.
 

Additional Inherited Members

- Public Types inherited from DriveNode
enum  DirectionType { DIR_STRAIGHT , DIR_LEFT , DIR_RIGHT , DIR_UNDEFINED }
 To indiciate in which direction the track is going: straight, left, right. More...
 
- Protected Attributes inherited from DriveNode
Vec3 m_lower_center
 Lower center point of the drive node.
 
Vec3 m_upper_center
 Upper center point of the drive node.
 
float m_distance_from_start
 Distance from the start to the beginning of the drive node.
 
- Protected Attributes inherited from Quad
Vec3 m_p [4]
 The four points of a quad.
 
Vec3 m_center
 The center of all four points, which is used by the AI.
 
int m_index
 Index of this quad, used only with graph.
 
Vec3 m_normal
 Normal of the quad.
 

Member Function Documentation

◆ getDistance2FromPoint()

float DriveNode2D::getDistance2FromPoint ( const Vec3 xyz) const
virtual

Returns the square of the distance between the given point and any point on the 'centre' line, i.e.

the finite line from the middle point of the lower end of the node to the middle point of the upper end of the node which belongs to this graph node. The value is computed in 2d only!

Parameters
xyzThe point for which the distance to the line is computed.

Reimplemented from Quad.

◆ getDistances()

void DriveNode2D::getDistances ( const Vec3 xyz,
Vec3 result 
) const
virtual

Returns the distance a point has from this node in forward and sidewards direction, i.e.

how far forwards the point is from the beginning of the node, and how far to the side from the line connecting the center points is it. All these computations are done in 2D only.

Parameters
xyzThe coordinates of the point.
resultThe X coordinate contains the sidewards distance, the Z coordinate the forward distance.

Implements DriveNode.

Member Data Documentation

◆ m_line

core::line2df DriveNode2D::m_line
private

Line between lower and upper center, saves computation in getDistance() later.

The line is 2d only since otherwise taller karts would have a larger distance from the center. It also saves computation, and it is only needed to determine the distance from the center of the drivelines anyway.

◆ m_lower_center_2d

core::vector2df DriveNode2D::m_lower_center_2d
private

The center point of the lower two points (e.g.

points 0 and 1). This saves some computations in getDistances later. Only the start point is needed, and only in 2d.


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