Commit 6342d294 authored by Alexander Krause's avatar Alexander Krause

added detection level of y-axis for rotation

parent ea52abda
......@@ -108,18 +108,16 @@ namespace ExplorVizGestureControl.Gestures
{
if (gripActive) return;
if (gestureDatabase.BothHandsParallel(0.60) &&
gestureDatabase.BothHandsAboveSpineBase() &&
gestureDatabase.HandsHaveAcceptableDistance(0.1) &&
!IntersectWithPhIZ() &&
if (gestureDatabase.BothHandsParallel(2) &&
gestureDatabase.BothHandsAboveSpineBase() &&
gestureDatabase.RightHandBelowRightShoulder() &&
gestureDatabase.LeftHandBelowLeftShoulder() &&
gestureDatabase.BothHandsOpen())
{
if (!rotationActive)
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
rotationActive = true;
oldHandRight = handRight;
rotationActive = true;
oldZ = handLeft.Z - handRight.Z;
oldY = handLeft.Y - handRight.Y;
}
......@@ -127,18 +125,24 @@ namespace ExplorVizGestureControl.Gestures
double distanceZ = 0;
double distanceY = 0;
double distanzeZHands = handLeft.Z - handRight.Z;
double distanzeYHands = handLeft.Y - handRight.Y;
double distanceZHands = handLeft.Z - handRight.Z;
double distanceYHands = handLeft.Y - handRight.Y;
int yDetection = 0;
double handsAbsDistanceY = Math.Abs(Math.Abs(handLeft.Y) - Math.Abs(handRight.Y));
//Console.WriteLine("{0}", handsAbsDistanceY);
if (distanzeZHands > oldZ + 0.005 || distanzeZHands < oldZ - 0.005) distanceZ = handLeft.Z - handRight.Z - oldZ;
if (handsAbsDistanceY > 0.09) yDetection = 500;
if (distanzeYHands > oldY + 0.005 || distanzeYHands < oldY - 0.005) distanceY = handLeft.Y - handRight.Y - oldY;
distanceZ = distanceZHands - oldZ;
distanceY = distanceYHands - oldY;
int moveX = (int)(distanceZ * 1000);
int moveY = (int)(distanceY * 500);
oldZ = handLeft.Z - handRight.Z;
oldY = handLeft.Y - handRight.Y;
int moveY = (int)(distanceY * yDetection);
oldZ = distanceZHands;
oldY = distanceYHands;
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, moveY);
......@@ -220,5 +224,6 @@ namespace ExplorVizGestureControl.Gestures
}
}
}
......@@ -41,6 +41,9 @@ namespace ExplorVizGestureControl.Gestures
public Vector3D head;
public Vector3D oldSpineBase;
public Vector3D handRightTip;
public Vector3D handLeftTip;
public PhIZ phiz;
public CameraSpacePoint[] filteredJoints;
......@@ -95,6 +98,8 @@ namespace ExplorVizGestureControl.Gestures
int jtSpineMid = (int)JointType.SpineMid;
int jtSpineBase = (int)JointType.SpineBase;
int jtHead = (int)JointType.Head;
int jtHandRightTip = (int)JointType.HandTipRight;
int jtHandLeftTip = (int)JointType.HandTipLeft;
oldSpineBase = spineBase;
......@@ -109,6 +114,8 @@ namespace ExplorVizGestureControl.Gestures
spineMid = new Vector3D(filteredJoints[jtSpineMid].X, filteredJoints[jtSpineMid].Y, filteredJoints[jtSpineMid].Z);
spineBase = new Vector3D(filteredJoints[jtSpineBase].X, filteredJoints[jtSpineBase].Y, filteredJoints[jtSpineBase].Z);
head = new Vector3D(filteredJoints[jtHead].X, filteredJoints[jtHead].Y, filteredJoints[jtHead].Z);
handRightTip = new Vector3D(filteredJoints[jtHandRightTip].X, filteredJoints[jtHandRightTip].Y, filteredJoints[jtHandRightTip].Z);
handLeftTip = new Vector3D(filteredJoints[jtHandLeftTip].X, filteredJoints[jtHandLeftTip].Y, filteredJoints[jtHandLeftTip].Z);
phiz.center = new Point(shoulderRight.X + 0.3, shoulderRight.Y);
phiz.topRightCorner = new Point(phiz.center.X + 0.2, phiz.center.Y + 0.3);
......
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