protected override void CheckStatus() { //Get the last postion and time xn.Point3D lastPosition = _traceHistory.Values[_traceHistory.Values.Count - 1]; float lastTime = _traceHistory.Keys[_traceHistory.Values.Count - 1]; //Initiate push detection if needed if (!_pushDetecting && _traceHistory.Values.Count >= 2) { //Detect if there is push. This is the case if the hand is moving towards the kinect. if (lastPosition.Z < _previousPoint.Z) { _startPoint = _previousPoint; _startTime = _previousTime; _pushDetecting = true; } } else { //Check if the detecting push is still valid if (lastPosition.Z < _previousPoint.Z) { float change = _startPoint.Z - lastPosition.Z; float duration = lastTime - _startTime; System.Diagnostics.Debug.WriteLine("Last Z:" + lastPosition.Z + " - previous Z:" + _previousPoint.Z + " - change" + change); //Check if the swip is completed. //This is true if the treshold is passed. CheckPushCompleted(lastPosition, duration, change, Gestures.Push); } else { ResetValues(); } } _previousPoint = lastPosition; _previousTime = lastTime; }
void sessionManager_SessionStart(ref xn.Point3D position) { }
void pointControl_PrimaryPointCreate(ref xnv.HandPointContext context, ref xn.Point3D pnt) { primaryHand = context; }
void selectableSlider_PrimaryPointCreate(ref xnv.HandPointContext context, ref xn.Point3D ptFocus) { this.SliderArea.BackColor = Color.Red; }
void sessionManager_SessionStart(ref xn.Point3D position) { this.flowRouter.SetActive(this.selectableSlider); }
private void ResetValues() { _pushDetecting = false; _startPoint = new xn.Point3D(); _startTime = 0; }