00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VRS_SPACEMOUSENAVIGATION_H
00019 #define VRS_SPACEMOUSENAVIGATION_H
00020
00021 #include <vrs/config.h>
00022 #include <vrs/sg/interactiontechnique.h>
00023
00024 namespace VRS {
00025
00042 class VRS_CORE_API SpaceMouseNavigation :
00043 public VRS::InteractionTechnique
00044 {
00045 public:
00046 VRS_TYPEINFO(SpaceMouseNavigation, VRS::InteractionTechnique);
00047
00049
00050 SpaceMouseNavigation();
00051
00053 void setMaxRotationSpeed(double speed = 180.);
00055 double getMaxRotationSpeed() const;
00056
00058 void setMaxPitchRotationSpeed(double speed = 90.);
00060 double getMaxPitchRotationSpeed() const;
00061
00069 void setVisualFlowSpeed(double screensPerSecond = 1.4, double fov = 60.0);
00073 void setRelativeSpeed(double unitsPerSecond);
00075 void setConstantSpeed(double unitsPerSecond);
00076
00078 bool constantSpeed() const;
00079
00081 double getVisualFlowSpeed(double fov) const;
00083 double getRelativeSpeed() const;
00085 double getConstantSpeed() const;
00086
00088 void setHeightFactor(double factor = 4.0);
00089 double getHeightFactor() const;
00090
00091
00092
00094 virtual bool checkEventRelevance(SO<VRS::Event> event) const;
00095
00097 virtual void onEvent(SO<VRS::Event> e);
00098
00100 virtual void onTimer(SO<VRS::TimeEvent> event, double secondsSinceLastTimeEvent);
00101
00102 private:
00103 VRS::Vector translation_;
00104 VRS::Vector rotation_;
00105 bool m_valuesAppliedOnTimer;
00106
00107 double maxXRotationSpeed_;
00108 double maxYRotationSpeed_;
00109
00110 double relativeSpeed_;
00111 double constantSpeed_;
00112 bool useConstantSpeed_;
00113 double heightFactor_;
00114
00115 public:
00121 static VRS::Vector polar2Cartesian(const VRS::Vector& v);
00122
00126 static VRS::Vector cartesian2Polar(const VRS::Vector& v);
00127
00136 static double visualFlow2horizontalMovement(double screens, double fov = 45.0);
00137
00140 static double horizontalMovement2visualFlow(double units, double fov = 45.0);
00141 };
00142
00143 }
00144
00145 #endif // VRS_SPACEMOUSENAVIGATION_H