public static void TestMotionFrameByIndex() { MotionSimilarity ms = new MotionSimilarity(); ms.CalcMotionSimilarity(new DummyUpdater()); var cost = ms.GetCostEstimate(); for (int i = 0; i < 10; i++) { int ii = MotionSimilarity.FindSmallestAfter(cost, i, float.NegativeInfinity, float.PositiveInfinity); var frame = ms.MotionFrameByIndex(ii); float c = MotionSimilarity.MotionSeqCost(ms.quat_, frame.index0, frame.index1); Debug.LogFormat("cost 0 {0} cost 1 {1}", cost[ii], c); } var largest = MotionSimilarity.FindLargestAfter(cost, 0, float.NegativeInfinity, float.PositiveInfinity); Debug.LogFormat("largest value {0}", cost[largest]); }
void OnGUI() { GUILayout.Label("Base Settings", EditorStyles.boldLabel); //myString = EditorGUILayout.TextField ("Text Field", myString); // animation_ = (AnimationClip)EditorGUILayout.ObjectField(animation_, typeof(AnimationClip)); //groupEnabled = EditorGUILayout.BeginToggleGroup ("Optional Settings", groupEnabled); //myBool = EditorGUILayout.Toggle ("Toggle", myBool); //myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); //EditorGUILayout.EndToggleGroup(); CurrIndex = EditorGUILayout.IntField(CurrIndex); animFig0_ = (GameObject)EditorGUILayout.ObjectField(animFig0_, typeof(GameObject), true); animFig1_ = (GameObject)EditorGUILayout.ObjectField(animFig1_, typeof(GameObject), true); if (GUILayout.Button("Extruct Feature")) { Debug.ClearDeveloperConsole(); //CallExtractMotionFeature(); ExtractingMotionFeatures(); } if (GUILayout.Button("Motion Similarity")) { Debug.ClearDeveloperConsole(); ms_.CalcMotionSimilarity(this); EditorUtility.ClearProgressBar(); } if (GUILayout.Button("Play Motion")) { Debug.ClearDeveloperConsole(); PlaySimilarMotion(animFig0_, animFig1_); } }