Commit 9bb38d3c authored by Alexander Krause's avatar Alexander Krause

...

parent 2ff5a011
......@@ -86,6 +86,8 @@ namespace ExplorVizGestureControl.Gestures
if (key.Equals("zoomVelocity")) scrollTimer.changeTimerCycle(value);
}
private int oldX = 0;
private void HandleRotation()
{
if (gripActive) return;
......@@ -97,7 +99,7 @@ namespace ExplorVizGestureControl.Gestures
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
rotationActive = true;
}
}
double distanceZ = 0;
double distanceY = 0;
......@@ -114,7 +116,24 @@ namespace ExplorVizGestureControl.Gestures
distanceY = distanceYHands - (GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y);
int moveX = (int)(distanceZ * 1000);
int moveY = (int)(distanceY * yDetection);
int moveY = (int)(distanceY * yDetection);
//////
Console.WriteLine(distanceZ);
/* if (!rotationActive) oldX = moveX;
if (Math.Abs(Math.Abs(moveX) - Math.Abs(oldX)) > 20)
{
Console.WriteLine("active");
oldX = moveX;
moveX = 0;
}
oldX = moveX;*/
//////
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, moveY);
}
......@@ -134,15 +153,12 @@ namespace ExplorVizGestureControl.Gestures
int scrollValue = 0;
double distance = GestureDatabase.Joints[(int)JointType.SpineBase].Z - GestureDatabase.PreviousFrameJoints[(int)JointType.SpineBase].Z;
//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)
if (scrollValue != 0 && !scrollTimer.busy)
{
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -scrollValue, 0);
scrollTimer.startTimer();
......@@ -152,6 +168,8 @@ namespace ExplorVizGestureControl.Gestures
private void HandleGripAndSelection()
{
if (rotationActive) return;
if (GestureDatabase.DragObject())
{
if (!gripActive)
......
......@@ -181,9 +181,21 @@ namespace ExplorVizGestureControl.Gestures
public static Boolean BothHandsParallel(double maxDistanceInX)
{
return (Math.Abs(joints[(int)JointType.HandRight].X - joints[(int)JointType.HandLeft].X) < maxDistanceInX &&
/*return (Math.Abs(joints[(int)JointType.HandRight].X - joints[(int)JointType.HandLeft].X) < maxDistanceInX &&
Math.Abs(Math.Abs(joints[(int)JointType.HandRight].Y) - Math.Abs(joints[(int)JointType.HandLeft].Y)) < 0.3 &&
Math.Abs(joints[(int)JointType.HandRight].Z - joints[(int)JointType.HandLeft].Z) < 0.3);
Math.Abs(joints[(int)JointType.HandRight].Z - joints[(int)JointType.HandLeft].Z) < 0.3);*/
double vectorLengthHandRight = Math.Sqrt(Math.Pow(joints[(int)JointType.HandRight].X, 2) +
Math.Pow(joints[(int)JointType.HandRight].Y, 2) +
Math.Pow(joints[(int)JointType.HandRight].Z, 2));
double vectorLengthHandLeft = Math.Sqrt(Math.Pow(joints[(int)JointType.HandLeft].X, 2) +
Math.Pow(joints[(int)JointType.HandLeft].Y, 2) +
Math.Pow(joints[(int)JointType.HandLeft].Z, 2));
Console.WriteLine(vectorLengthHandRight - vectorLengthHandLeft);
return false;
}
public static Boolean BothHandsAboveHead()
......
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