protected override void Analyze(FrameReadyEventArgs frameReadyEventArgs) { if (!Configuration.movementNavigation) return; var frames = _framesCollector.GetFrames().ToList(); if (frames.Count == 0) { return; } var joints = frames.Select(a => a.GetNearestSkeleton().Joints.First(j => j.JointType ==_joint)).ToList(); Vector3 calculateDisplacementVector = CalculateDisplacement(joints); if (calculateDisplacementVector.Length > MinimalVectorLength) { _oldDisplacementVector = calculateDisplacementVector; } var duration = CalculateDuration(frames); LogString.Log("Event: ContinousMovementAnalyzer: " + calculateDisplacementVector.X + " " + calculateDisplacementVector.Y + " " + calculateDisplacementVector.Z); Raise(()=>RaiseEvent(frames, _oldDisplacementVector, duration)); }
protected void RaiseEvent(List<Frame> frames, Vector3 calculateDisplacementVector, long duration) { if (frames.Last().Timestamp - LastFrameTimestamp > MinimalPeriodBetweenGestures && MovementDetected != null) { MovementDetected(this, new MovementEventArgs(calculateDisplacementVector, duration, _joint)); } }