NearTrack.h

Go to the documentation of this file.
00001 
00005 /* Copyright © 2010 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 
00012 #ifndef LIBTRACK_NEAR_TRACK_H
00013 #define LIBTRACK_NEAR_TRACK_H
00014 
00015 #include "Mesh/MeshFaces.h"
00016 
00017 #include <set>
00018 
00019 namespace Track
00020 {
00021 
00024 enum SensorIndex
00025 {
00026     SENSOR_NAVIGABLE_DISTANCE = 0, 
00027     SENSOR_UNSIGNED_ANGLE = 1, 
00028     SENSOR_LAP_DISTANCE = 2, 
00029     SENSOR_LAP_DIFFERENTIAL = 3, 
00030     SENSOR_COUNT = 4 
00031 };
00032 
00033 class Track;
00034 
00037 class NearTrack
00038 {
00039     public:
00046         NearTrack(const MeshFaces::Graph & graph, btVector3 position);
00047         
00048         virtual ~NearTrack();
00049         
00061         btScalar move_towards(btVector3 position);
00062         
00074         btScalar jump_to(btVector3 position);
00075         
00078         btVector3 get_position() const;
00079         
00082         MeshFaces::Graph::vertex_descriptor get_face_descriptor() const;
00083         
00085         enum AttachSource
00086         {
00087             AS_VERTEX, 
00088             AS_EDGE, 
00089             AS_UNKOWN 
00090         };
00091         
00094         AttachSource get_object_type() const;
00095         
00099         unsigned long int get_object_name() const;
00100         
00124         void scan_direction(btVector3 glob, btScalar * results) const;
00125     protected:
00133         btVector3 m_object_coord;
00134         
00138         AttachSource m_object_type;
00139         
00140         unsigned long int m_object_name;
00141         
00145         btVector3 m_world_coord;
00146         
00150         MeshFaces::Graph::vertex_descriptor m_face;
00151         
00155         btScalar m_face_s;
00156         
00160         btScalar m_face_t;
00161         
00163         const MeshFaces::Graph & m_graph;
00164         
00166         std::set<MeshFaces::Graph::vertex_descriptor> examined;
00168         btScalar best_distance;
00170         MeshFaces::Graph::vertex_descriptor best_face;
00172         btVector3 best_world_coords;
00173         
00181         static btScalar face_u_interpolation(MeshFaces::FaceGraph face, btVector3 point);
00182         
00186         void set_info();
00187         
00188         void move_towards_recursive(btVector3 position);
00189 };
00190 
00191 } // namespace Track
00192 
00193 #endif // LIBTRACK_NEAR_TRACK_H

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

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