Commit 80a100af authored by Alexander Krause's avatar Alexander Krause

WIP: zooming via physical steps

parent 52e43b77
......@@ -44,7 +44,7 @@ namespace ExplorVizGestureControl.Gestures
private Vector3D oldHandRight;
private Boolean gripActive = false;
private Dictionary<string, double> dynamicValues = new Dictionary<string, double>();
private Dictionary<string, double> dynamicValues = new Dictionary<string, double>();
#endregion
......@@ -56,8 +56,8 @@ namespace ExplorVizGestureControl.Gestures
// dynamic values initialization
dynamicValues.Add("scrollAccelerationFactor", 2000);
dynamicValues.Add("scrollForwardFactor", 0.07);
dynamicValues.Add("scrollBackwardFactor", 0.02);
dynamicValues.Add("scrollForwardFactor", 0.05);
dynamicValues.Add("scrollBackwardFactor", 0.05);
dynamicValues.Add("zoomVelocity", 250);
scrollTimer = new GestureTimer(dynamicValues["zoomVelocity"]);
......@@ -157,18 +157,20 @@ namespace ExplorVizGestureControl.Gestures
{
if (gripActive) return;
int scrollValue = 0;
double distance = gestureDatabase.spineBase.Z - (gestureDatabase.spineMid.Z - 0.09);
int scrollValue = 0;
double distance = gestureDatabase.spineBase.Z - gestureDatabase.oldSpineBase.Z;
if (distance >= dynamicValues["scrollForwardFactor"] ||
distance < dynamicValues["scrollBackwardFactor"])
//if (distance > dynamicValues["scrollForwardFactor"] ||
// distance < dynamicValues["scrollBackwardFactor"])
if (Math.Abs(distance) != dynamicValues["scrollForwardFactor"])
{
scrollValue = (int)(distance * dynamicValues["scrollAccelerationFactor"]);
}
if (scrollValue != 0 && !scrollTimer.busy)
//if (scrollValue != 0)
{
// mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrollValue, 0);
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -scrollValue, 0);
scrollTimer.startTimer();
}
}
......
......@@ -38,6 +38,7 @@ namespace ExplorVizGestureControl.Gestures
public Vector3D spineMid;
public Vector3D spineBase;
public Vector3D head;
public Vector3D oldSpineBase;
public PhIZ phiz;
public CameraSpacePoint[] filteredJoints;
......@@ -94,6 +95,8 @@ namespace ExplorVizGestureControl.Gestures
int jtSpineBase = (int)JointType.SpineBase;
int jtHead = (int)JointType.Head;
oldSpineBase = spineBase;
elbowLeft = new Vector3D(filteredJoints[jtElbowLeft].X, filteredJoints[jtElbowLeft].Y, filteredJoints[jtElbowLeft].Z);
elbowRight = new Vector3D(filteredJoints[jtElbowRight].X, filteredJoints[jtElbowRight].Y, filteredJoints[jtElbowRight].Z);
handLeft = new Vector3D(filteredJoints[jtHandLeft].X, filteredJoints[jtHandLeft].Y, filteredJoints[jtHandLeft].Z);
......@@ -257,7 +260,7 @@ namespace ExplorVizGestureControl.Gestures
foreach (Vector3D oldHead in headsStack)
{
if (head.Y > oldHead.Y + 0.1)
if (head.Y > oldHead.Y + 0.05)
{
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment