/// <summary> /// Create deep copy of this sequence. /// </summary> /// <returns>Copy of sequence.</returns> public DirectionSequence Clone() { DirectionSequence newSeq = new DirectionSequence(this.type); newSeq.sequence = new List<DirectionRecognition.Directions>(this.sequence); newSeq.type = this.type; return newSeq; }
/// <summary> /// Try to recognize single poitn gesture. Used instead of RecognizeGestureForMultipleSequences, unless propper gesture end detection with multiple points isnt finished. /// </summary> /// <param name="joint">Type of tracked joint.</param> /// <param name="seq">Recognized sequence.</param> private void RecognizeGestureForSingleSequences(JointType joint, DirectionSequence seq) { Dictionary<JointType, int[]> observations = new Dictionary<JointType, int[]>(); //is not sequence "empty" if (!seq.IsMostlyStill()) { //cleanup sequence seq.Trim(); //emit evet on sequence ready OnSequenceReady(seq); //fill up observation field observations.Add(joint, seq.ToArray); //recognize if (observations.Count > 0) RecognizeGesture(observations); } //clear sequence seq.Clear(); }
/// <summary> /// Creates new instance by passing sequence data. /// </summary> /// <param name="seq">Should be copy of recorded sequence data (original data can be erased after this call).</param> public SequenceEventArgs(DirectionSequence seq) { Sequence = seq; }
/// <summary> /// Emits SequenceReady event. /// </summary> /// <remarks>Create copy of passed sequence, so it can be changed/cleared after call.</remarks> /// <param name="sequence">Sequence to be added into event arguments.</param> private void OnSequenceReady(DirectionSequence sequence) { //create copy of sequence (sequence is recycling in normal case) only if there if any listener if (SequenceReady != null) SequenceReady(this, new SequenceEventArgs(sequence.Clone())); }