00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 /*============================================================================== 00024 * Classes : SoTrackFollower 00025 * Author(s) : Fabien ARNAUD 00026 * : Jerome HUMMEL 00027 * Date : Jul, 23 2002 00028 *============================================================================== 00029 * 00030 * Description : See below 00031 * 00032 *============================================================================*/ 00033 00034 #ifndef _SO_TRACK_FOLLOWER_H_ 00035 #define _SO_TRACK_FOLLOWER_H_ 00036 00037 #include <Inventor/engines/SoSubEngine.h> 00038 #include <Inventor/fields/SoSFFloat.h> 00039 #include <Inventor/fields/SoMFFloat.h> 00040 #include <Inventor/fields/SoSFVec3f.h> 00041 #include <Inventor/fields/SoMFVec3f.h> 00042 #include <Inventor/fields/SoSFBool.h> 00043 #include <Inventor/fields/SoMFBool.h> 00044 #include <Inventor/fields/SoSFRotation.h> 00045 #include <Inventor/fields/SoMFRotation.h> 00046 #include <Inventor/nodes/SoCoordinate3.h> 00047 00048 #define SO_UNDEFINED_TIME_STAMP (-1) 00049 00050 00051 00103 class SoTrackFollower : public SoEngine { 00104 00105 SO_ENGINE_HEADER (SoTrackFollower); 00106 00107 public: 00108 00109 // Input fields 00113 SoMFVec3f points; 00114 00144 SoMFFloat timeStamps; 00145 00156 SoMFFloat radius; 00157 00158 00174 SoMFFloat rollAngle; 00175 00187 SoMFFloat rollSpeed; 00188 00199 SoMFBool keepRollAngle; 00200 00208 SoMFRotation headRotation; 00209 00213 SoSFFloat alpha; 00214 00225 SoSFBool loop; 00226 00232 SoSFBool useHeadRotationOnly; 00233 00234 // Output fields 00235 00239 SoEngineOutput position; // (SoSFVec3f) position 00240 00246 SoEngineOutput orientation; // (SoSFRotation) position 00247 00248 // Constructor 00249 00253 SoTrackFollower(); 00254 00255 private: 00256 // Internal values access 00257 00262 float getAlphaValue (int control_point) 00263 { return m_01_time [control_point]; } 00264 00273 void getTrackCoordinate (SoCoordinate3* coords, float width = 1, SbBool flat = FALSE, int precision = 16); 00274 00279 void computeData (float alpha, SbVec3f& vessel_pos, SbRotation& vessel_rot, SbRotation& roll_rot, SbRotation& head_rot); 00280 00281 private: 00282 static void initClass(); 00283 static void exitClass(); 00284 00285 private: 00286 // Destructor 00287 ~SoTrackFollower(); 00288 00289 virtual void inputChanged (SoField* whichField); 00290 00291 // Evaluation method 00292 virtual void evaluate(); 00293 00294 private: 00295 // Time used for interpolation 00296 void compute01Time(); 00297 float* m_01_time; 00298 SbBool m_need_01time_computation; 00299 00300 // Smooth angles 00301 void computeAngles(); 00302 SbBool m_need_angles_computation; 00303 float* m_turn_start_time; 00304 float* m_turn_end_time; 00305 float* m_turn_gamma; 00306 SbVec3f* m_turn_center; 00307 SbVec3f* m_turn_normal; 00308 SbVec3f* m_turn_start_point; 00309 SbVec3f* m_turn_end_point; 00310 }; 00311 00312 #endif // _SO_TRACK_FOLLOWER_H_ 00313 00314 00315