Track::Path Class Reference

A graph describing the track layout. More...

#include <Path.h>

Inheritance diagram for Track::Path:

Track::Drawable Track::AABBBounded List of all members.

Public Types

typedef boost::adjacency_list<
boost::vecS, boost::vecS,
boost::bidirectionalS, PathVertex,
PathEdge
Graph
 Graph of track layout.

Public Member Functions

 Path (std::istream &source, const Theme &theme, const Track *track, bool editor=false)
 initalise from a stream
 Path (const Theme &theme, const Track *track, bool editor=false)
 Make an empty path.
virtual ~Path ()
AxisAlignedBoundingBox get_bounding_box () const
 Get the axis aligned bounding box of the vertices and control points in the path with some padding.
PathVertexget_node (const std::size_t index)
 find a graph node by ID
const PathVertexget_node (const std::size_t index) const
 find a graph node by ID
Path::Graph::vertex_descriptor get_node_descriptor (const std::size_t index)
 find a graph node descriptor by ID
const Path::Graph::vertex_descriptor get_node_descriptor (const std::size_t index) const
 find a graph node descriptor by ID
PathEdgeget_edge (const std::size_t index)
 find a graph edge by ID
const PathEdgeget_edge (const std::size_t index) const
 find a graph edge by ID
Path::Graph::edge_descriptor get_edge_descriptor (const std::size_t index)
 find a graph edge descriptor by ID
const Path::Graph::edge_descriptor get_edge_descriptor (const std::size_t index) const
 find a graph edge descriptor by ID
void set_handle_lengths (btScalar handle_length)
 Set the lengths of the rotation handles present in the path's vertices.
void update_connected_edges (Path::Graph::vertex_descriptor vertex_descriptor)
 Update the edges connected to a particular vertex.
const EditAssist::SegmentConnectionHandleget_nearest_segment_connection_handle (btVector3 position) const
 Find the nearest SegmentConnectionHandle to the given position.
const EditAssist::SegmentConnectionHandleget_nearest_segment_connection_handle (btVector3 position, btVector3 normal) const
 Find the nearest SegmentConnectionHandle to the given line.
void add_collision_faces (btTriangleMesh &shape) const
 Add the surfaces you can collide with to a shape.
void add_floor_faces (btTriangleMesh &shape) const
 Add the surfaces you should be able to drive on to a shape.
void add_ai_faces (MeshFaces &mesh) const
 Add the surface AI considers to a mesh.
unsigned long int get_starting_edge () const
 return the name of the edge which cars should start the race on.
void set_starting_edge (unsigned long int new_edge_name)
 change the edge cars start on.
void find_start_plane (btVector3 &normal, btScalar &distance) const
 Find the plane where start/finish line is on.
btVector3 find_start_position () const
 Get the centre of the disc used as the start finish line.
virtual void draw () const
 Draw the object.
virtual void conditional_draw (const OcclusionTester &occlusion_tester) const
 Draw the object if it is visible.
virtual AxisAlignedBoundingBox get_bounds () const
 Get the Axis aligned bounding box of the object.

Public Attributes

Graph graph
bool editor
 True to make paths appear wireframe, false for solid shading.

Private Member Functions

Path::Graph::vertex_descriptor get_node_descriptor_internal (const std::size_t index) const
Path::Graph::edge_descriptor get_edge_descriptor_internal (const std::size_t index) const

Private Attributes

const unsigned int file_version
const Themetheme
unsigned long int starting_edge
 The name of the edge to start the cars on, or 0 if not set properly.

Friends

std::ostream & operator<< (std::ostream &destination, const Path &path)

Detailed Description

A graph describing the track layout.

Definition at line 43 of file Path.h.


Member Typedef Documentation

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, PathVertex, PathEdge> Track::Path::Graph

Graph of track layout.

Definition at line 59 of file Path.h.


Constructor & Destructor Documentation

Track::Path::Path ( std::istream &  source,
const Theme theme,
const Track track,
bool  editor = false 
)

initalise from a stream

Definition at line 23 of file Path.cpp.

Track::Path::Path ( const Theme theme,
const Track track,
bool  editor = false 
)

Make an empty path.

Definition at line 89 of file Path.cpp.

Track::Path::~Path (  )  [virtual]

Definition at line 97 of file Path.cpp.


Member Function Documentation

void Track::Path::add_ai_faces ( MeshFaces mesh  )  const

Add the surface AI considers to a mesh.

Definition at line 365 of file Path.cpp.

void Track::Path::add_collision_faces ( btTriangleMesh &  shape  )  const

Add the surfaces you can collide with to a shape.

Definition at line 323 of file Path.cpp.

void Track::Path::add_floor_faces ( btTriangleMesh &  shape  )  const

Add the surfaces you should be able to drive on to a shape.

Definition at line 344 of file Path.cpp.

void Track::Path::conditional_draw ( const OcclusionTester occlusion_tester  )  const [virtual]

Draw the object if it is visible.

Parameters:
occlusion_tester Reference to object describing planes of the view's frustrum to test against.

Reimplemented from Track::Drawable.

Definition at line 439 of file Path.cpp.

void Track::Path::draw (  )  const [virtual]

Draw the object.

Called indirectly by draw(const OcclusionTester &) const when it is on the screen, but can also be called manually if view bounds are not known.

Implements Track::Drawable.

Definition at line 415 of file Path.cpp.

void Track::Path::find_start_plane ( btVector3 &  normal,
btScalar &  distance 
) const

Find the plane where start/finish line is on.

Finds the plane of the start / finish line in Hessian normal form.

Parameters:
normal Variable to be set to the unit normal of the plane
distance Variable to be set to the distance of the plane from the origin.

Definition at line 397 of file Path.cpp.

btVector3 Track::Path::find_start_position (  )  const

Get the centre of the disc used as the start finish line.

Definition at line 408 of file Path.cpp.

AxisAlignedBoundingBox Track::Path::get_bounding_box (  )  const

Get the axis aligned bounding box of the vertices and control points in the path with some padding.

Todo:
return the axis aligned bounding box of the path instead.

Monitor changes to graph, then only calculate when it has changed.

Definition at line 138 of file Path.cpp.

AxisAlignedBoundingBox Track::Path::get_bounds (  )  const [virtual]

Get the Axis aligned bounding box of the object.

The object is contained entierly within this region.

Implements Track::AABBBounded.

Definition at line 466 of file Path.cpp.

const PathEdge & Track::Path::get_edge ( const std::size_t  index  )  const

find a graph edge by ID

Definition at line 216 of file Path.cpp.

PathEdge & Track::Path::get_edge ( const std::size_t  index  ) 

find a graph edge by ID

Definition at line 211 of file Path.cpp.

const Path::Graph::edge_descriptor Track::Path::get_edge_descriptor ( const std::size_t  index  )  const

find a graph edge descriptor by ID

Definition at line 226 of file Path.cpp.

Path::Graph::edge_descriptor Track::Path::get_edge_descriptor ( const std::size_t  index  ) 

find a graph edge descriptor by ID

Definition at line 221 of file Path.cpp.

Path::Graph::edge_descriptor Track::Path::get_edge_descriptor_internal ( const std::size_t  index  )  const [private]

Definition at line 231 of file Path.cpp.

const EditAssist::SegmentConnectionHandle * Track::Path::get_nearest_segment_connection_handle ( btVector3  position,
btVector3  normal 
) const

Find the nearest SegmentConnectionHandle to the given line.

Parameters:
position A point on the line
normal A normal vector pointing down the line.

Todo:
take into account normal.

Definition at line 317 of file Path.cpp.

const EditAssist::SegmentConnectionHandle * Track::Path::get_nearest_segment_connection_handle ( btVector3  position  )  const

Find the nearest SegmentConnectionHandle to the given position.

Definition at line 287 of file Path.cpp.

const PathVertex & Track::Path::get_node ( const std::size_t  index  )  const

find a graph node by ID

Definition at line 175 of file Path.cpp.

PathVertex & Track::Path::get_node ( const std::size_t  index  ) 

find a graph node by ID

Definition at line 170 of file Path.cpp.

const Path::Graph::vertex_descriptor Track::Path::get_node_descriptor ( const std::size_t  index  )  const

find a graph node descriptor by ID

Definition at line 185 of file Path.cpp.

Path::Graph::vertex_descriptor Track::Path::get_node_descriptor ( const std::size_t  index  ) 

find a graph node descriptor by ID

Definition at line 180 of file Path.cpp.

Path::Graph::vertex_descriptor Track::Path::get_node_descriptor_internal ( const std::size_t  index  )  const [private]

Definition at line 190 of file Path.cpp.

unsigned long int Track::Path::get_starting_edge (  )  const

return the name of the edge which cars should start the race on.

If no edge has been provided, returns 0. The first edge becomes the starting edge when loading from a stream, so if you get a track this way you don't need to check for 0.

Definition at line 386 of file Path.cpp.

void Track::Path::set_handle_lengths ( btScalar  handle_length  ) 

Set the lengths of the rotation handles present in the path's vertices.

Parameters:
handle_length The length the handles extend from the point they rotate.

Definition at line 251 of file Path.cpp.

void Track::Path::set_starting_edge ( unsigned long int  new_edge_name  ) 

change the edge cars start on.

Definition at line 391 of file Path.cpp.

void Track::Path::update_connected_edges ( Path::Graph::vertex_descriptor  vertex_descriptor  ) 

Update the edges connected to a particular vertex.

This recalculates the length, number of segments, and meshes. You should call this after changing a vertex's position, segment, or angle.

Parameters:
vertex_descriptor The vertex descriptor of the vertex that was changed.

Definition at line 263 of file Path.cpp.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  destination,
const Path path 
) [friend]

Definition at line 102 of file Path.cpp.


Member Data Documentation

bool Track::Path::editor

True to make paths appear wireframe, false for solid shading.

Definition at line 117 of file Path.h.

const unsigned int Track::Path::file_version [private]

Definition at line 151 of file Path.h.

Graph Track::Path::graph

Definition at line 60 of file Path.h.

unsigned long int Track::Path::starting_edge [private]

The name of the edge to start the cars on, or 0 if not set properly.

Definition at line 156 of file Path.h.

const Theme& Track::Path::theme [private]

Definition at line 152 of file Path.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:18 2010 by Doxygen version 1.4.7 for Racer version svn335.