mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-03 10:58:34 -06:00
Version of touch interface for user study that has disabled panning and limited zoom to prevent zooming through the planet surface
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#define DISABLE_PANNING
|
||||
#define INCREASE_SURFACE_THRESHOLD_TO_LIMIT_ZOOM
|
||||
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
@@ -447,10 +449,12 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
|
||||
if (nDOF > 2) {
|
||||
_vel.zoom = par.at(2);
|
||||
_vel.roll = par.at(3);
|
||||
#ifndef DISABLE_PANNING
|
||||
if (nDOF > 4) {
|
||||
_vel.roll = 0.0;
|
||||
_vel.pan = glm::dvec2(par.at(4), par.at(5));
|
||||
}
|
||||
#endif //#ifndef DISABLE_PANNING
|
||||
}
|
||||
step(1.0);
|
||||
|
||||
@@ -649,7 +653,11 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
}
|
||||
else {
|
||||
// if average distance between 3 fingers are constant we have panning
|
||||
#ifdef DISABLE_PANNING
|
||||
if (false) {
|
||||
#else
|
||||
if (std::abs(dist - lastDist) / list.at(0).getMotionSpeed() < _interpretPan && list.size() == 3) {
|
||||
#endif //#ifdef DISABLE_PANNING
|
||||
return PAN;
|
||||
}
|
||||
// we have roll if one finger is still, or the total roll angles around the centroid is over _rollAngleThreshold (_centroidStillThreshold is used to void misinterpretations)
|
||||
@@ -795,9 +803,12 @@ void TouchInteraction::step(double dt) {
|
||||
{ // Zooming
|
||||
centerToBoundingSphere = -directionToCenter * boundingSphere;
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
double distToSurface = length(centerToCamera - centerToBoundingSphere);
|
||||
|
||||
if (length(_vel.zoom*dt) < distToSurface && length(centerToCamera + directionToCenter*_vel.zoom*dt) > length(centerToBoundingSphere)) {
|
||||
double planetBoundaryRadius = length(centerToBoundingSphere);
|
||||
#ifdef INCREASE_SURFACE_THRESHOLD_TO_LIMIT_ZOOM
|
||||
planetBoundaryRadius *= 1.001;
|
||||
#endif //#ifdef INCREASE_SURFACE_THRESHOLD_TO_LIMIT_ZOOM
|
||||
double distToSurface = length(centerToCamera - planetBoundaryRadius);
|
||||
if (length(_vel.zoom*dt) < distToSurface && length(centerToCamera + directionToCenter*_vel.zoom*dt) > planetBoundaryRadius) {
|
||||
camPos += directionToCenter * _vel.zoom * dt;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user