| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/sg/spacemousenavigation.h>

Public Member Functions | |
| VRS_TYPEINFO (SpaceMouseNavigation, VRS::InteractionTechnique) | |
| SpaceMouseNavigation () | |
| Creates a SpaceMouseNavigation. | |
| void | setMaxRotationSpeed (double speed=180.) |
| Set maximum speed (degrees per second) for the rotation about the y-axis. | |
| double | getMaxRotationSpeed () const |
| Get maximum speed (degrees per second) for the rotation about the y-axis. | |
| void | setMaxPitchRotationSpeed (double speed=90.) |
| Set maximum speed (degrees per second) for the rotation about the x-axis. | |
| double | getMaxPitchRotationSpeed () const |
| Get maximum speed (degrees per second) for the rotation about the x-axis. | |
| void | setVisualFlowSpeed (double screensPerSecond=1.4, double fov=60.0) |
| The speed for horizontal movement can be set in three different modes: (default is a) a) Visual flow: To keep the visible changes on the screen inside a reasonable range, the speed of the horizontal movement is proportional to the avatar height. | |
| void | setRelativeSpeed (double unitsPerSecond) |
| b) Relative speed: Using the following method, the walk speed is also adapted to the height, but is specified directly for a height of 1.0. | |
| void | setConstantSpeed (double unitsPerSecond) |
| c) Constant speed: By settting a constant speed, the speed is equal for all heights. | |
| bool | constantSpeed () const |
| Returns true if a constant speed is set. | |
| double | getVisualFlowSpeed (double fov) const |
| Note: This method must not be called if a constant speed is set. | |
| double | getRelativeSpeed () const |
| Note: This method must not be called if a constant speed is set. | |
| double | getConstantSpeed () const |
| Note: Must only be called if a constant speed is set. | |
| void | setHeightFactor (double factor=4.0) |
| During pulling or pushing the device, the height is multiplied with this factor once per second. | |
| double | getHeightFactor () const |
| virtual bool | checkEventRelevance (SO< VRS::Event > event) const |
| Returns true on SpaceMouseEvents in order to activate ourself. | |
| virtual void | onEvent (SO< VRS::Event > e) |
| Handles the SpaceMouseEvents. | |
| virtual void | onTimer (SO< VRS::TimeEvent > event, double secondsSinceLastTimeEvent) |
| Handles the timer events. | |
Static Public Member Functions | |
| *static VRS::Vector | polar2Cartesian (const VRS::Vector &v) |
| Maps special polar coordinates to cartesian coordinates. | |
| *static VRS::Vector | cartesian2Polar (const VRS::Vector &v) |
| Inverse mapping for polar2cartesian, assuming that the up-VRSVector did not change in between. | |
| static double | visualFlow2horizontalMovement (double screens, double fov=45.0) |
| For terrain-based navigations it can be useful to keep the horizontal movement speed proportional to the camera height. | |
| *static double | horizontalMovement2visualFlow (double units, double fov=45.0) |
| Converts horizontal lengths (in units) to visual flow (in screens). | |
This navigation does not use the normal mouse or any keys from the keyboard, so it does not have any FunctionIDs. It basically handles SpaceMouseEvents, which are generated if you use the SpaceMouseDevice registered at a QtWinApplication. See the example code below which should be present in your main.cpp file:
VRS::QtWinApplication* myApp = new VRS::QtWinApplication(argc, argv);
QMainWindow mainWindow(NULL, "mainwindow"); SO<VRS::SpaceMouseDevice> spaceMouse = new VRS::SpaceMouseDevice(&mainWindow); if(spaceMouse->getState() == VRS::SpaceMouseDevice::NoError) { myApp->registerDevice(spaceMouse); } Remark: This navigation technique assume that the camera up vector is (0,1,0).
| VRS::SpaceMouseNavigation::SpaceMouseNavigation | ( | ) |
Creates a SpaceMouseNavigation.
| VRS::SpaceMouseNavigation::VRS_TYPEINFO | ( | SpaceMouseNavigation | , | |
| VRS::InteractionTechnique | ||||
| ) |
| void VRS::SpaceMouseNavigation::setMaxRotationSpeed | ( | double | speed = 180. |
) |
Set maximum speed (degrees per second) for the rotation about the y-axis.
| double VRS::SpaceMouseNavigation::getMaxRotationSpeed | ( | ) | const |
Get maximum speed (degrees per second) for the rotation about the y-axis.
| void VRS::SpaceMouseNavigation::setMaxPitchRotationSpeed | ( | double | speed = 90. |
) |
Set maximum speed (degrees per second) for the rotation about the x-axis.
| double VRS::SpaceMouseNavigation::getMaxPitchRotationSpeed | ( | ) | const |
Get maximum speed (degrees per second) for the rotation about the x-axis.
| void VRS::SpaceMouseNavigation::setVisualFlowSpeed | ( | double | screensPerSecond = 1.4, |
|
| double | fov = 60.0 | |||
| ) |
The speed for horizontal movement can be set in three different modes: (default is a) a) Visual flow: To keep the visible changes on the screen inside a reasonable range, the speed of the horizontal movement is proportional to the avatar height.
For convenience it can be specified approximately in terms of visual flow, i.e. the speeed is adjusted so that looking from the given height the terrain moves a certain number of screens per second. For this, the field-of-view is needed.
| void VRS::SpaceMouseNavigation::setRelativeSpeed | ( | double | unitsPerSecond | ) |
b) Relative speed: Using the following method, the walk speed is also adapted to the height, but is specified directly for a height of 1.0.
If you want a speed of 's' in a height of 'h' you achieve this by setRelativeWalkSpeed(s/h)
| void VRS::SpaceMouseNavigation::setConstantSpeed | ( | double | unitsPerSecond | ) |
c) Constant speed: By settting a constant speed, the speed is equal for all heights.
| bool VRS::SpaceMouseNavigation::constantSpeed | ( | ) | const |
Returns true if a constant speed is set.
| double VRS::SpaceMouseNavigation::getVisualFlowSpeed | ( | double | fov | ) | const |
Note: This method must not be called if a constant speed is set.
| double VRS::SpaceMouseNavigation::getRelativeSpeed | ( | ) | const |
Note: This method must not be called if a constant speed is set.
| double VRS::SpaceMouseNavigation::getConstantSpeed | ( | ) | const |
Note: Must only be called if a constant speed is set.
| void VRS::SpaceMouseNavigation::setHeightFactor | ( | double | factor = 4.0 |
) |
During pulling or pushing the device, the height is multiplied with this factor once per second.
| double VRS::SpaceMouseNavigation::getHeightFactor | ( | ) | const |
| virtual bool VRS::SpaceMouseNavigation::checkEventRelevance | ( | SO< VRS::Event > | event | ) | const [virtual] |
Returns true on SpaceMouseEvents in order to activate ourself.
Reimplemented from VRS::InteractionTechnique.
| virtual void VRS::SpaceMouseNavigation::onEvent | ( | SO< VRS::Event > | e | ) | [virtual] |
| virtual void VRS::SpaceMouseNavigation::onTimer | ( | SO< VRS::TimeEvent > | event, | |
| double | secondsSinceLastTimeEvent | |||
| ) | [virtual] |
| * static VRS::Vector VRS::SpaceMouseNavigation::polar2Cartesian | ( | const VRS::Vector & | v | ) | [static] |
Maps special polar coordinates to cartesian coordinates.
The polar VRS::Vector (0,0,1) is mapped to a unit VRS::Vector on the plane through the origin with the up VRS::Vector as normal. The first two coordinates are angles in degrees, the first one specifying rotation around the up-VRSVector, the second one specifying the rotation around an orthogonal right VRS::Vector, the third coordinate specifies the length.
| * static VRS::Vector VRS::SpaceMouseNavigation::cartesian2Polar | ( | const VRS::Vector & | v | ) | [static] |
Inverse mapping for polar2cartesian, assuming that the up-VRSVector did not change in between.
The resulting angles are inside the range ]-180, 180] for the first component (latitude) and inside ]-90, 90] for the second component (altitude).
| static double VRS::SpaceMouseNavigation::visualFlow2horizontalMovement | ( | double | screens, | |
| double | fov = 45.0 | |||
| ) | [static] |
For terrain-based navigations it can be useful to keep the horizontal movement speed proportional to the camera height.
This allows to specify horizontal movement speed in an intuitive way by visual flow: Looking down from an height h the time in which "one screen width of terrain" passes the camera should should be independent on the value of h. To calculate it, a field-of-view-value is needed. This method can be used by derivatives to convert from visual flow (in screens) to the absolute lengths (in units when moving in a height of 1.0). To obtain the necessary length at a heigth of h, multiply the result with h.
| * static double VRS::SpaceMouseNavigation::horizontalMovement2visualFlow | ( | double | units, | |
| double | fov = 45.0 | |||
| ) | [static] |
Converts horizontal lengths (in units) to visual flow (in screens).
See visualFlow2horizontalMovement() comment for details.