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

changes of today's benchmark

parent 1235cc0a
...@@ -50,8 +50,8 @@ namespace ExplorVizGestureControl.Gestures ...@@ -50,8 +50,8 @@ namespace ExplorVizGestureControl.Gestures
dynamicValues.Add("scrollAccelerationFactor", 2000); dynamicValues.Add("scrollAccelerationFactor", 2000);
dynamicValues.Add("scrollActivation", 0.05); dynamicValues.Add("scrollActivation", 0.05);
dynamicValues.Add("zoomVelocity", 250); dynamicValues.Add("zoomVelocity", 250);
dynamicValues.Add("rotationVelocityX", 1000); dynamicValues.Add("rotationVelocityX", 2000);
dynamicValues.Add("rotationVelocityY", 500); dynamicValues.Add("rotationVelocityY", 1000);
dynamicValues.Add("rotationYActivation", 0.12); dynamicValues.Add("rotationYActivation", 0.12);
scrollTimer = new GestureTimer(dynamicValues["zoomVelocity"]); scrollTimer = new GestureTimer(dynamicValues["zoomVelocity"]);
...@@ -91,14 +91,18 @@ namespace ExplorVizGestureControl.Gestures ...@@ -91,14 +91,18 @@ namespace ExplorVizGestureControl.Gestures
if (key.Equals("zoomVelocity")) scrollTimer.changeTimerCycle(value); if (key.Equals("zoomVelocity")) scrollTimer.changeTimerCycle(value);
} }
float oldZZ;
float oldYY;
private void HandleRotation() private void HandleRotation()
{ {
if (gripActive) return; //if (gripActive) return;
if (!rotationActive) if (!rotationActive)
{ {
if (GestureDatabase.ActivateRotation(2.0f)) //if (GestureDatabase.ActivateRotation(2.0f))
if (GestureDatabase.HandsAboveSpineBase(1))
{ {
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
rotationActive = true; rotationActive = true;
...@@ -106,21 +110,20 @@ namespace ExplorVizGestureControl.Gestures ...@@ -106,21 +110,20 @@ namespace ExplorVizGestureControl.Gestures
else { return; } else { return; }
} }
if (!GestureDatabase.LeftHandClosed() && if (GestureDatabase.LeftHandClosed())
!GestureDatabase.HandsCrossed())
{ {
if (rotationActive && !GestureDatabase.HandsAboveSpineBase(1, 0.1f)) /*if (rotationActive && !GestureDatabase.HandsAboveSpineBase(1, 0.1f))
{ {
rotationActive = false; rotationActive = false;
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
return; return;
} }*/
double distanceZ = 0; double distanceZ = 0;
double distanceY = 0; double distanceY = 0;
double distanceZHands = GestureDatabase.Joints[(int)JointType.HandLeft].Z - GestureDatabase.Joints[(int)JointType.HandRight].Z; /*double distanceZHands = GestureDatabase.Joints[(int)JointType.HandLeft].Z - GestureDatabase.Joints[(int)JointType.HandRight].Z;
double distanceYHands = GestureDatabase.Joints[(int)JointType.HandLeft].Y - GestureDatabase.Joints[(int)JointType.HandRight].Y; double distanceYHands = GestureDatabase.Joints[(int)JointType.HandLeft].Y - GestureDatabase.Joints[(int)JointType.HandRight].Y;
int yDetection = 0; int yDetection = 0;
...@@ -132,9 +135,31 @@ namespace ExplorVizGestureControl.Gestures ...@@ -132,9 +135,31 @@ namespace ExplorVizGestureControl.Gestures
distanceY = distanceYHands - (GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y); distanceY = distanceYHands - (GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y);
int moveX = (int)(distanceZ * dynamicValues["rotationVelocityX"]); int moveX = (int)(distanceZ * dynamicValues["rotationVelocityX"]);
int moveY = (int)(distanceY * yDetection); int moveY = (int)(distanceY * yDetection);*/
float distanceZHands = GestureDatabase.Joints[(int)JointType.HandLeft].X - GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].X;
float distanceYHands = GestureDatabase.Joints[(int)JointType.HandLeft].Y - GestureDatabase.PreviousFrameJoints[(int)JointType.HandLeft].Y;
int yDetection = 0;
//float handsAbsDistanceY = Math.Abs(Math.Abs(GestureDatabase.Joints[(int)JointType.HandLeft].Y) - Math.Abs(GestureDatabase.Joints[(int)JointType.HandRight].Y));
//if (handsAbsDistanceY > dynamicValues["rotationYActivation"]) yDetection = (int)dynamicValues["rotationVelocityY"];
yDetection = (int)dynamicValues["rotationVelocityY"];
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, moveY); //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);
//distanceZ = distanceZHands;
// distanceY = distanceYHands;
//oldZZ = distanceZHands;
//oldYY = distanceYHands;
int moveX = (int)(distanceZHands * dynamicValues["rotationVelocityX"]);
int moveY = (int)(distanceYHands * yDetection);
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, -moveY);
} }
else if (rotationActive) else if (rotationActive)
{ {
...@@ -165,7 +190,7 @@ namespace ExplorVizGestureControl.Gestures ...@@ -165,7 +190,7 @@ namespace ExplorVizGestureControl.Gestures
private void HandleGripAndSelection() private void HandleGripAndSelection()
{ {
if (rotationActive) return; //if (rotationActive) return;
if (!GestureDatabase.DragObject() && selectionStatus == 1) if (!GestureDatabase.DragObject() && selectionStatus == 1)
{ {
...@@ -173,17 +198,19 @@ namespace ExplorVizGestureControl.Gestures ...@@ -173,17 +198,19 @@ namespace ExplorVizGestureControl.Gestures
selectionTimer.startTimer(); selectionTimer.startTimer();
} }
if (!GestureDatabase.DragObject() && selectionStatus == 2 && !selectionTimer.busy) //if (!GestureDatabase.DragObject() && selectionStatus == 2 && !selectionTimer.busy)
if (!GestureDatabase.DragObject() && selectionStatus == 2)
{ {
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
selectionStatus = 0; selectionStatus = 0;
} }
if (!GestureDatabase.DragObject() && selectionStatus == 3 && selectionTimer.busy) //if (!GestureDatabase.DragObject() && selectionStatus == 3 && selectionTimer.busy)
if (!GestureDatabase.DragObject() && selectionStatus == 3)
{ {
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(150); //Thread.Sleep(150);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
selectionStatus = 0; selectionStatus = 0;
} }
...@@ -198,7 +225,7 @@ namespace ExplorVizGestureControl.Gestures ...@@ -198,7 +225,7 @@ namespace ExplorVizGestureControl.Gestures
float vLength = GestureDatabase.CalculateVectorLength(GestureDatabase.Joints[(int)JointType.HandRight]); float vLength = GestureDatabase.CalculateVectorLength(GestureDatabase.Joints[(int)JointType.HandRight]);
if (selectionStatus == 2 && selectionTimer.busy) selectionStatus = 3; if (selectionStatus == 2) selectionStatus = 3;
// If hand position didn't change 1 cm, do no more processing for this frame // If hand position didn't change 1 cm, do no more processing for this frame
if (Math.Abs(rightHandAnchorLength - vLength) < 0.01f) return; if (Math.Abs(rightHandAnchorLength - vLength) < 0.01f) return;
...@@ -216,8 +243,8 @@ namespace ExplorVizGestureControl.Gestures ...@@ -216,8 +243,8 @@ namespace ExplorVizGestureControl.Gestures
double distanceY = GestureDatabase.Joints[(int)JointType.HandRight].Y - double distanceY = GestureDatabase.Joints[(int)JointType.HandRight].Y -
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y; GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Y;
int moveX = (int)(distanceX * 1000); int moveX = (int)(distanceX * 3000);
int moveY = (int)(distanceY * 1000); int moveY = (int)(distanceY * 3000);
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, -moveY); Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y) + new Size(moveX, -moveY);
} }
......
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