Commit 2ff5a011 authored by Alexander Krause's avatar Alexander Krause

rotation improvement

parent d6f7025f
......@@ -31,11 +31,8 @@ namespace ExplorVizGestureControl.Gestures
private GestureTimer openObjectTimer;
internal static GestureTimer delayTimer;
private Boolean rotationActive = false;
private double oldZ = 0;
private double oldY = 0;
private Boolean gripActive = false;
private Boolean rotationActive = false;
private Boolean gripActive = false;
private Dictionary<string, double> dynamicValues = new Dictionary<string, double>();
......@@ -62,12 +59,12 @@ namespace ExplorVizGestureControl.Gestures
public void DetectContinousGestures()
{
if (delayTimer.busy) return;
if (IntersectWithPhIZ() || gripActive) HandleGripAndSelection();
if (delayTimer.busy) return;
HandleRotation();
HandleZoom();
if (IntersectWithPhIZ() || gripActive) HandleGripAndSelection();
}
......@@ -94,17 +91,12 @@ namespace ExplorVizGestureControl.Gestures
if (gripActive) return;
if (GestureDatabase.BothHandsParallel(2) &&
GestureDatabase.BothHandsAboveSpineBase() &&
GestureDatabase.RightHandBelowRightShoulder() &&
GestureDatabase.LeftHandBelowLeftShoulder() &&
GestureDatabase.BothHandsOpen())
GestureDatabase.BothHandsAboveSpineBase())
{
if (!rotationActive)
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
rotationActive = true;
oldZ = GestureDatabase.Joints[(int)JointType.HandLeft].Z - GestureDatabase.Joints[(int)JointType.HandRight].Z;
oldY = GestureDatabase.Joints[(int)JointType.HandLeft].Y - GestureDatabase.Joints[(int)JointType.HandRight].Y;
rotationActive = true;
}
double distanceZ = 0;
......@@ -115,23 +107,16 @@ namespace ExplorVizGestureControl.Gestures
int yDetection = 0;
double handsAbsDistanceY = Math.Abs(Math.Abs(GestureDatabase.Joints[(int)JointType.HandLeft].Y) - Math.Abs(GestureDatabase.Joints[(int)JointType.HandRight].Y));
if (handsAbsDistanceY > 0.12) yDetection = 500;
//Console.WriteLine("{0}", handsAbsDistanceY);
if (handsAbsDistanceY > 0.09) yDetection = 500;
distanceZ = distanceZHands - oldZ;
distanceY = distanceYHands - oldY;
distanceZ = distanceZHands - (GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Z - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Z);
distanceY = distanceYHands - (GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y);
int moveX = (int)(distanceZ * 1000);
int moveY = (int)(distanceY * yDetection);
oldZ = distanceZHands;
oldY = distanceYHands;
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, moveY);
}
else if (rotationActive)
{
......
......@@ -13,7 +13,7 @@ namespace ExplorVizGestureControl.Gestures
{
public static class GestureDatabase
{
public struct PhIZ
public struct PhIZ
{
public Point center;
public Point topRightCorner;
......@@ -244,7 +244,7 @@ namespace ExplorVizGestureControl.Gestures
for (int i = 0; i < arrayLength; i++)
{
if (joints[(int)JointType.Head].Y > headsStack[i].Y + 0.05)
if (joints[(int)JointType.Head].Y > headsStack[i].Y + 0.05f)
{
confidenceArray[i] = 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