00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _CELENGINE_OBSERVER_H_
00019 #define _CELENGINE_OBSERVER_H_
00020
00021 #include <celengine/frame.h>
00022
00023 class Observer
00024 {
00025 public:
00026 Observer();
00027
00028
00029
00030 UniversalCoord getPosition() const;
00031
00032
00033
00034
00035 Point3d getRelativePosition(const Point3d&) const;
00036
00037 Quatf getOrientation() const;
00038 void setOrientation(const Quatf&);
00039 void setOrientation(const Quatd&);
00040 Vec3d getVelocity() const;
00041 void setVelocity(const Vec3d&);
00042 Vec3f getAngularVelocity() const;
00043 void setAngularVelocity(const Vec3f&);
00044
00045 void setPosition(BigFix x, BigFix y, BigFix z);
00046 void setPosition(const UniversalCoord&);
00047 void setPosition(const Point3d&);
00048
00049 RigidTransform getSituation() const;
00050 void setSituation(const RigidTransform&);
00051
00052 float getFOV() const;
00053 void setFOV(float);
00054
00055 void update(double dt, double timeScale);
00056
00057 Vec3f getPickRay(float x, float y) const;
00058
00059
00060 void orbit(const Selection&, Quatf q);
00061 void rotate(Quatf q);
00062 void changeOrbitDistance(const Selection&, float d);
00063 void setTargetSpeed(float s);
00064 float getTargetSpeed();
00065
00066 Selection getTrackedObject() const;
00067 void setTrackedObject(const Selection&);
00068
00069 const std::string& getDisplayedSurface() const;
00070 void setDisplayedSurface(const std::string&);
00071
00072 uint32 getLocationFilter() const;
00073 void setLocationFilter(uint32);
00074
00075 void gotoSelection(const Selection&,
00076 double gotoTime,
00077 Vec3f up,
00078 astro::CoordinateSystem upFrame);
00079 void gotoSelection(const Selection&,
00080 double gotoTime,
00081 double startInter,
00082 double endInter,
00083 Vec3f up,
00084 astro::CoordinateSystem upFrame);
00085 void gotoSelectionGC(const Selection&,
00086 double gotoTime,
00087 double startInter,
00088 double endInter,
00089 Vec3f up,
00090 astro::CoordinateSystem upFrame);
00091 void gotoSelection(const Selection&,
00092 double gotoTime,
00093 double distance,
00094 Vec3f up,
00095 astro::CoordinateSystem upFrame);
00096 void gotoSelectionLongLat(const Selection&,
00097 double gotoTime,
00098 double distance,
00099 float longitude, float latitude,
00100 Vec3f up);
00101 void gotoLocation(const RigidTransform& transform,
00102 double duration);
00103 void getSelectionLongLat(const Selection&,
00104 double& distance,
00105 double& longitude,
00106 double& latitude);
00107 void gotoSelectionGC(const Selection& selection,
00108 double gotoTime,
00109 double distance,
00110 Vec3f up,
00111 astro::CoordinateSystem upFrame);
00112 void gotoSurface(const Selection&, double duration);
00113 void centerSelection(const Selection&, double centerTime = 0.5);
00114 void centerSelectionCO(const Selection&, double centerTime = 0.5);
00115 void follow(const Selection&);
00116 void geosynchronousFollow(const Selection&);
00117 void phaseLock(const Selection&);
00118 void chase(const Selection&);
00119 void cancelMotion();
00120
00121 void reverseOrientation();
00122
00123 void setFrame(const FrameOfReference&);
00124 FrameOfReference getFrame() const;
00125
00126 double getArrivalTime() const;
00127
00128 double getTime() const;
00129 void setTime(double);
00130
00131 enum ObserverMode {
00132 Free = 0,
00133 Travelling = 1,
00134 };
00135
00136 ObserverMode getMode() const;
00137 void setMode(ObserverMode);
00138
00139 enum TrajectoryType {
00140 Linear = 0,
00141 GreatCircle = 1,
00142 CircularOrbit = 2,
00143 };
00144
00145 struct JourneyParams
00146 {
00147 double duration;
00148 double startTime;
00149 UniversalCoord from;
00150 UniversalCoord to;
00151 Quatf initialOrientation;
00152 Quatf finalOrientation;
00153 double startInterpolation;
00154 double endInterpolation;
00155 double expFactor;
00156 double accelTime;
00157 Quatf rotation1;
00158
00159 Selection centerObject;
00160
00161 TrajectoryType traj;
00162 };
00163
00164 void gotoJourney(const JourneyParams&);
00165
00166
00167 private:
00168 void computeGotoParameters(const Selection& sel,
00169 JourneyParams& jparams,
00170 double gotoTime,
00171 double startInter,
00172 double endInter,
00173 Vec3d offset,
00174 astro::CoordinateSystem offsetFrame,
00175 Vec3f up,
00176 astro::CoordinateSystem upFrame);
00177 void computeGotoParametersGC(const Selection& sel,
00178 JourneyParams& jparams,
00179 double gotoTime,
00180 double startInter,
00181 double endInter,
00182 Vec3d offset,
00183 astro::CoordinateSystem offsetFrame,
00184 Vec3f up,
00185 astro::CoordinateSystem upFrame,
00186 const Selection& centerObj);
00187 void computeCenterParameters(const Selection& sel,
00188 JourneyParams& jparams,
00189 double centerTime);
00190 void computeCenterCOParameters(const Selection& sel,
00191 JourneyParams& jparams,
00192 double centerTime);
00193
00194 private:
00195 double simTime;
00196
00197 RigidTransform situation;
00198 Vec3d velocity;
00199 Vec3f angularVelocity;
00200
00201 double realTime;
00202
00203 double targetSpeed;
00204 Vec3d targetVelocity;
00205 Vec3d initialVelocity;
00206 double beginAccelTime;
00207
00208 ObserverMode observerMode;
00209 JourneyParams journey;
00210 FrameOfReference frame;
00211 Selection trackObject;
00212
00213 Quatf trackingOrientation;
00214
00215 float fov;
00216 bool reverseFlag;
00217
00218 uint32 locationFilter;
00219 std::string displayedSurface;
00220 };
00221
00222 #endif // _CELENGINE_OBSERVER_H_