From ad1a4a21fb1bfdee7d94634a1a34a64e493ebd84 Mon Sep 17 00:00:00 2001 From: GPayne Date: Wed, 1 Nov 2017 16:32:24 -0600 Subject: [PATCH] Version of touch interface for user study that has disabled panning and limited zoom to prevent zooming through the planet surface --- modules/touch/src/touchinteraction.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 7f86603100..bf3e7e3bfe 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -61,6 +61,8 @@ #endif // WIN32 +#define DISABLE_PANNING +#define INCREASE_SURFACE_THRESHOLD_TO_LIMIT_ZOOM #include #include @@ -447,10 +449,12 @@ void TouchInteraction::directControl(const std::vector& 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& 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 {