Commit b35af908 authored by Alexander Krause's avatar Alexander Krause

fixed zoom-in

parent baa5e1e4
......@@ -31,7 +31,7 @@ namespace ExplorVizGestureControl.Gestures
private static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
#region Variables
internal static GestureTimer delayTimer;
private GestureTimer[] timers;
......@@ -48,7 +48,7 @@ namespace ExplorVizGestureControl.Gestures
KinectSensor kinect = KinectSensor.GetDefault();
// dynamic values initialization, based on gui
dynamicValues.Add("zoomAccelerationFactor", 5);
dynamicValues.Add("zoomAccelerationFactor", 5);
dynamicValues.Add("rotationVelocityX", 2000);
dynamicValues.Add("rotationVelocityY", 1000);
dynamicValues.Add("rotationYActivation", 0.04);
......@@ -65,8 +65,8 @@ namespace ExplorVizGestureControl.Gestures
timers = new GestureTimer[3];
timers[0] = new GestureTimer(2000);
timers[1] = new GestureTimer(500);
timers[0] = new GestureTimer(700);
timers[1] = new GestureTimer(500);
timers[2] = new GestureTimer(500);
}
......@@ -79,7 +79,7 @@ namespace ExplorVizGestureControl.Gestures
Zoom();
Rotation();
if ((IntersectWithPhIZ()) || flags[1] == 1) GripAndSelection();
}
......@@ -96,14 +96,14 @@ namespace ExplorVizGestureControl.Gestures
public void UpdateDynamicValues(string key, double value)
{
dynamicValues[key] = value;
dynamicValues[key] = value;
}
#region Gestures
private void Rotation()
{
{
if (flags[2] == 1 || flags[2] == 1) return;
int rotationActive = 0;
......@@ -137,7 +137,7 @@ namespace ExplorVizGestureControl.Gestures
if (!timers[1].busy && flags[rotationActive] == 0)
{
if (Math.Abs(anchors[rotationAnchorLength] - vLength) < 0.015f)
{
{
mouse_event(MOUSE_EVENTS.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
flags[rotationActive] = 1;
}
......@@ -149,7 +149,7 @@ namespace ExplorVizGestureControl.Gestures
}
if (flags[rotationActive] == 1)
{
{
float distanceXHands = 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;
......@@ -176,7 +176,7 @@ namespace ExplorVizGestureControl.Gestures
private void Zoom()
{
{
if (flags[0] == 1 || timers[0].busy) return;
int zoomingActive = 2;
......@@ -200,23 +200,22 @@ namespace ExplorVizGestureControl.Gestures
}
float currentZ = GestureDatabase.Joints[(int)JointType.HandRight].Z;
if (zoomingActive == 1 || (!timers[2].busy && (currentZ < anchors[zoomAnchorZ] + 0.015f) &&
(currentZ < anchors[zoomAnchorZ] + 0.015f)))
{
zoomingActive = 1;
if (flags[zoomingActive] == 1 || (!timers[2].busy && (currentZ < anchors[zoomAnchorZ] + 0.015f)))
{
flags[zoomingActive] = 1;
float distance = GestureDatabase.Joints[(int)JointType.HandRight].Z -
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Z;
GestureDatabase.PreviousFrameJoints[(int)JointType.HandRight].Z;
if (distance >= 0f && GestureDatabase.BothHandsClosed())
{
flags[zoomStatus] = 2;
}
else if (distance < 0f && GestureDatabase.BothHandsClosed()) { return; }
if (distance < 0 && GestureDatabase.BothHandsOpen())
{
if (distance < 0f && GestureDatabase.BothHandsOpen())
{
if (flags[zoomStatus] == 2)
{
flags[zoomStatus] = 3;
......@@ -225,8 +224,8 @@ namespace ExplorVizGestureControl.Gestures
}
flags[zoomStatus] = 3;
}
else if (distance >= 0 && GestureDatabase.BothHandsOpen()) { return; }
else if (distance >= 0f && GestureDatabase.BothHandsOpen()) { return; }
// For small changes between frames, we need a high multiplicator,
// because of the cast.
int scrollValue = (int)(distance * 20000);
......@@ -248,7 +247,7 @@ namespace ExplorVizGestureControl.Gestures
int gripActive = 1;
int selectionStatus = 4;
int selectionAnchorLength = 0;
int selectionAnchorLength = 0;
if (!GestureDatabase.RightHandClosed() && flags[selectionStatus] == 1)
{
......
......@@ -123,7 +123,7 @@ namespace ExplorVizGestureControl.Gestures
#region HandStates
public static bool RightHandClosed()
{
{
return handRightState == HandState.Closed ? true : false;
}
......@@ -193,7 +193,7 @@ namespace ExplorVizGestureControl.Gestures
Boolean parallelInZ = joints[(int)JointType.HandRight].Z < joints[(int)JointType.HandLeft].Z + maxDistanceInZ &&
joints[(int)JointType.HandRight].Z > joints[(int)JointType.HandLeft].Z - maxDistanceInZ;
return parallelInY && parallelInZ;
}
......
......@@ -39,8 +39,7 @@ namespace ExplorVizGestureControl
private KinectSensor kinect;
private Body[] bodies;
private BodyFrameReader bodyReader;
private ulong bodyTrackingID = 0;
private BodyFrameReader bodyReader;
private int bodyIndex;
private ContinuousGestureDetector continuousGestureDetector;
......@@ -135,7 +134,7 @@ namespace ExplorVizGestureControl
bodyIndex = GetCenteredBodyIndex();
if (bodies[bodyIndex].IsTracked && NoClippedEdges(bodies[bodyIndex]))
{
{
filter.UpdateFilter(bodies[bodyIndex]);
CameraSpacePoint[] filteredJoints = filter.GetFilteredJoints();
Vector3D[] accumulatedJoints = jointAccumulator.AccumulateJoints(filteredJoints);
......@@ -219,8 +218,7 @@ namespace ExplorVizGestureControl
return true;
}
else
{
bodyTrackingID = 0;
{
return false;
}
}
......
......@@ -34,7 +34,6 @@ C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\bin\D
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\obj\Debug\ExplorVizGestureControl.exe
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\bin\Debug\ExplorVizGestureControl.exe
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\bin\Debug\ExplorVizGestureControl.pdb
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\bin\Debug\Microsoft.Kinect.dll
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\bin\Debug\Microsoft.Kinect.xml
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\obj\Debug\ExplorVizGestureControl.csprojResolveAssemblyReference.cache
C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\obj\Debug\MainWindow.baml
......
......@@ -13,7 +13,7 @@ C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\App.x
11151548125
161086153555
151583282685
152029983729
MainWindow.xaml;
False
......
......@@ -13,7 +13,7 @@ C:\Users\Virtual-Reality\Documents\gesture-control\ExplorVizGestureControl\App.x
11151548125
20-288322765
151583282685
152029983729
MainWindow.xaml;
False
......
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