#include <NearTrack.h>
Inheritance diagram for Track::NearTrack:
Public Types | |
AS_VERTEX | |
Attachted to a Track::PathVertex. | |
AS_EDGE | |
Attached to a Track::PathEdge. | |
AS_UNKOWN | |
Not correctly attached to anything. | |
enum | AttachSource { AS_VERTEX, AS_EDGE, AS_UNKOWN } |
The types of objects Track::NearTrack can attach to. More... | |
Public Member Functions | |
NearTrack (const MeshFaces::Graph &graph, btVector3 position) | |
Construct with an initial position. | |
virtual | ~NearTrack () |
btScalar | move_towards (btVector3 position) |
Move the attach point closer to a position. | |
btScalar | jump_to (btVector3 position) |
Set the attach point to the closest point on the AI navigation mesh. | |
btVector3 | get_position () const |
Return the position in world space. | |
MeshFaces::Graph::vertex_descriptor | get_face_descriptor () const |
Return the face the position is on. | |
AttachSource | get_object_type () const |
Return the type of object the point is attached to. | |
unsigned long int | get_object_name () const |
Get the identifier for the object the point is attached to. | |
void | scan_direction (btVector3 glob, btScalar *results) const |
Calculate statistics about potential movement in a given direction. | |
Protected Member Functions | |
void | set_info () |
Set m_object_coord m_object_name m_object_type, m_face_s/t from m_face. | |
void | move_towards_recursive (btVector3 position) |
Static Protected Member Functions | |
static btScalar | face_u_interpolation (MeshFaces::FaceGraph face, btVector3 point) |
Find a u texture coordinate at a point on a face. | |
Protected Attributes | |
btVector3 | m_object_coord |
Relative coordinates for edge or vertex attached to. | |
AttachSource | m_object_type |
The type of object the Track::NearTrack is attached to. | |
unsigned long int | m_object_name |
btVector3 | m_world_coord |
World coordinates. | |
MeshFaces::Graph::vertex_descriptor | m_face |
AI mesh face attached to. | |
btScalar | m_face_s |
Coordinates in the direction of m_face's fv1 -> fv2 edge. | |
btScalar | m_face_t |
Coordinates in the direction of m_face's fv1 -> fv3 edge. | |
const MeshFaces::Graph & | m_graph |
The mesh we can navigate over. | |
std::set< MeshFaces::Graph::vertex_descriptor > | examined |
The vertices examined in move_towards(). | |
btScalar | best_distance |
The lowest distance reached in move_towards(). | |
MeshFaces::Graph::vertex_descriptor | best_face |
The face with the lowest distance reached in move_towards(). | |
btVector3 | best_world_coords |
The world coordianates of the solution with the lowest distance reached by move_towards(). |
Definition at line 37 of file NearTrack.h.
The types of objects Track::NearTrack can attach to.
AS_VERTEX | Attachted to a Track::PathVertex. |
AS_EDGE | Attached to a Track::PathEdge. |
AS_UNKOWN | Not correctly attached to anything. |
Definition at line 85 of file NearTrack.h.
Track::NearTrack::NearTrack | ( | const MeshFaces::Graph & | graph, | |
btVector3 | position | |||
) |
Construct with an initial position.
graph | The navigation grap to constrain too. Cannot be changed or deleted until the NearTrack is deleted. | |
position | The nearest world space coordinates to the desired starting position. |
Definition at line 20 of file NearTrack.cpp.
Track::NearTrack::~NearTrack | ( | ) | [virtual] |
Definition at line 26 of file NearTrack.cpp.
btScalar Track::NearTrack::face_u_interpolation | ( | MeshFaces::FaceGraph | face, | |
btVector3 | point | |||
) | [static, protected] |
Find a u texture coordinate at a point on a face.
The u texture coordinate is used for lap distance.
face | The face to inspect. | |
point | The point in global coordinates to inspect. |
Definition at line 354 of file NearTrack.cpp.
MeshFaces::Graph::vertex_descriptor Track::NearTrack::get_face_descriptor | ( | ) | const |
unsigned long int Track::NearTrack::get_object_name | ( | ) | const |
Get the identifier for the object the point is attached to.
Useful when combined with get_source_type.
Definition at line 158 of file NearTrack.cpp.
NearTrack::AttachSource Track::NearTrack::get_object_type | ( | ) | const |
btVector3 Track::NearTrack::get_position | ( | ) | const |
btScalar Track::NearTrack::jump_to | ( | btVector3 | position | ) |
Set the attach point to the closest point on the AI navigation mesh.
This is much slower than move_towards(btVector3). Use that if you can help it.
Time complexity is O(n), where n is the number of triangles in the ai navigation mesh.
position. | The world coordinate to jump to. |
Definition at line 115 of file NearTrack.cpp.
btScalar Track::NearTrack::move_towards | ( | btVector3 | position | ) |
Move the attach point closer to a position.
Requires an up to date AI mesh in the track.
The path taken will be continuous. It won't move to the nearest point if the nearest point is not on a reasonable path from the current location.
position | The world coordinate to move towards. |
Definition at line 38 of file NearTrack.cpp.
void Track::NearTrack::move_towards_recursive | ( | btVector3 | position | ) | [protected] |
Definition at line 55 of file NearTrack.cpp.
void Track::NearTrack::scan_direction | ( | btVector3 | glob, | |
btScalar * | results | |||
) | const |
Calculate statistics about potential movement in a given direction.
Projections the direction of the given vector onto the current face, then finds the furthest edge in that direction. If the edge is shared, project the face vector onto the next face recursively. When the edge is not shared, the total navigable distance in that direction is returned.
glob | global vector giving the direction to scan. The length of the vector is the maximum distance to scan. | |
results | address of the first of 4 btScalars to store the calculated statistics:
|
Definition at line 163 of file NearTrack.cpp.
void Track::NearTrack::set_info | ( | ) | [protected] |
Set m_object_coord m_object_name m_object_type, m_face_s/t from m_face.
Finds relavent information from the graph face.
Definition at line 362 of file NearTrack.cpp.
btScalar Track::NearTrack::best_distance [protected] |
MeshFaces::Graph::vertex_descriptor Track::NearTrack::best_face [protected] |
The face with the lowest distance reached in move_towards().
Definition at line 170 of file NearTrack.h.
btVector3 Track::NearTrack::best_world_coords [protected] |
The world coordianates of the solution with the lowest distance reached by move_towards().
Definition at line 172 of file NearTrack.h.
std::set<MeshFaces::Graph::vertex_descriptor> Track::NearTrack::examined [protected] |
MeshFaces::Graph::vertex_descriptor Track::NearTrack::m_face [protected] |
AI mesh face attached to.
Will be invalid when the track changes.
Definition at line 150 of file NearTrack.h.
btScalar Track::NearTrack::m_face_s [protected] |
Coordinates in the direction of m_face's fv1 -> fv2 edge.
Will be invalid when the track changes.
Definition at line 155 of file NearTrack.h.
btScalar Track::NearTrack::m_face_t [protected] |
Coordinates in the direction of m_face's fv1 -> fv3 edge.
Will be invalid when the track changes.
Definition at line 160 of file NearTrack.h.
const MeshFaces::Graph& Track::NearTrack::m_graph [protected] |
btVector3 Track::NearTrack::m_object_coord [protected] |
Relative coordinates for edge or vertex attached to.
For an edge, this is distorted to lie along the edge. The y coordinate for an edge is between 0 (start) and 1 (finish) of the edge. The x and z coordinates are used like the edge's meshes.
For a vertex, it is in the vertex's local space.
Definition at line 133 of file NearTrack.h.
unsigned long int Track::NearTrack::m_object_name [protected] |
Definition at line 140 of file NearTrack.h.
AttachSource Track::NearTrack::m_object_type [protected] |
The type of object the Track::NearTrack is attached to.
May Unkown if the relavent object is deleted from the track.
Definition at line 138 of file NearTrack.h.
btVector3 Track::NearTrack::m_world_coord [protected] |
World coordinates.
May become outdated when the track changes.
Definition at line 145 of file NearTrack.h.
Generated at Mon Sep 6 00:41:18 2010 by Doxygen version 1.4.7 for Racer version svn335.