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-2020 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 00107 class SoTrackFollower : public SoEngine { 00108 00109 SO_ENGINE_HEADER (SoTrackFollower); 00110 00111 public: 00112 00113 // Input fields 00117 SoMFVec3f points; 00118 00148 SoMFFloat timeStamps; 00149 00160 SoMFFloat radius; 00161 00162 00178 SoMFFloat rollAngle; 00179 00191 SoMFFloat rollSpeed; 00192 00203 SoMFBool keepRollAngle; 00204 00212 SoMFRotation headRotation; 00213 00217 SoSFFloat alpha; 00218 00229 SoSFBool loop; 00230 00236 SoSFBool useHeadRotationOnly; 00237 00238 // Output fields 00239 00243 SoEngineOutput position; // (SoSFVec3f) position 00244 00250 SoEngineOutput orientation; // (SoSFRotation) position 00251 00252 // Constructor 00253 00257 SoTrackFollower(); 00258 00259 private: 00260 // Internal values access 00261 00266 float getAlphaValue (int control_point) 00267 { return m_01_time [control_point]; } 00268 00277 void getTrackCoordinate (SoCoordinate3* coords, float width = 1, SbBool flat = FALSE, int precision = 16); 00278 00283 void computeData (float alpha, SbVec3f& vessel_pos, SbRotation& vessel_rot, SbRotation& roll_rot, SbRotation& head_rot); 00284 00285 private: 00286 static void initClass(); 00287 static void exitClass(); 00288 00289 private: 00290 // Destructor 00291 ~SoTrackFollower(); 00292 00293 virtual void inputChanged (SoField* whichField); 00294 00295 // Evaluation method 00296 virtual void evaluate(); 00297 00298 private: 00299 // Time used for interpolation 00300 void compute01Time(); 00301 float* m_01_time; 00302 SbBool m_need_01time_computation; 00303 00304 // Smooth angles 00305 void computeAngles(); 00306 SbBool m_need_angles_computation; 00307 float* m_turn_start_time; 00308 float* m_turn_end_time; 00309 float* m_turn_gamma; 00310 SbVec3f* m_turn_center; 00311 SbVec3f* m_turn_normal; 00312 SbVec3f* m_turn_start_point; 00313 SbVec3f* m_turn_end_point; 00314 }; 00315 00316 #endif // _SO_TRACK_FOLLOWER_H_ 00317 00318 00319