//need to refactor //have a split for analysis between last frame and all other frames public bool Handle(MyoDataAnalyzer analyzer) { this.Analyzer = analyzer; //check to see if this is the last frame or not if (ToMatchFrameIndex + 1 == ToMatch.Count) { var result = GestureMatchingEngine.LastFrameAnalyze(this); if (result == LastFrameResult.Matched) { return(MatchingSuccess()); } else if (result == LastFrameResult.Failed) { return(MatchingFailed()); } else { return(false); } } else { if (GestureMatchingEngine.FrameAnalyze(this)) { return(false); } else { return(MatchingFailed()); } } }
//return true if not matched, else return false private bool MatchingAnalysis(GestureState gesture) { if (gesture.ToMatchFrameIndex + 1 == gesture.ToMatch.Count) { var result = GestureMatchingEngine.LastFrameAnalyze(gesture); if (result == LastFrameResult.Matched) { gesture.Matched = true; return(false); } else if (result == LastFrameResult.Failed) { return(true); } else { return(false); } } else { if (GestureMatchingEngine.FrameAnalyze(gesture)) { return(false); } else { return(true); } } }