private Trajectory.Snippet GetCurrentSnippet() { Trajectory.Snippet snippet; int futureFramesNumber = FramesPerPoint * FeaturePoints; // Get simulated future List <(Vector3, Quaternion)> futureTransforms = this._mc.GetFuture(futureFramesNumber); // Convert the (many) Frames to (few) Point and add them to the Trajectory for (int i = 0; i < FeaturePoints; i++) { //Trajectory.Point point = Trajectory.Point.getMedianPoint(futureFrames.GetRange(i * Trajectory.FramesPerPoint, Trajectory.FramesPerPoint)); //Trajectory.Point point = new Trajectory.Point(futureFrames[i * Feature.FramesPerPoint + Feature.FramesPerPoint / 2].GetXZVector2()); Trajectory.Point point = new Trajectory.Point( futureTransforms[(i + 1) * FramesPerPoint - 1].Item1.GetXZVector2(), futureTransforms[(i + 1) * FramesPerPoint - 1].Item2 ); this._trajectory.points.Add(point); } // Compute the Trajectory Snippet snippet = this._trajectory.GetLocalSnippet(FeaturePastPoints - 1); // Remove future Points from Trajectory this._trajectory.points.RemoveRange(FeaturePastPoints, FeaturePoints); return(snippet); }
private Trajectory ComputeFittedTrajectory() { Trajectory fittedTrajectory = new Trajectory(); for ( int frameNum = SalamanderController.FramesPerPoint / 2; frameNum < this.frameList.Count - SalamanderController.FramesPerPoint; frameNum += SalamanderController.FramesPerPoint ) { // Find the median Point of all the frames in the current sample //Trajectory.Point point = Trajectory.Point.getMedianPoint( // this.frameList.GetRange(frameNum - SalamanderController.FramesPerPoint / 2, SalamanderController.FramesPerPoint).ConvertAll( // f => (f.boneDataDict[Bone.Type.root].position.GetXZVector2(), f.boneDataDict[Bone.Type.root].rotation.eulerAngles) // ) // ); // (TODO FINAL): set it to use root and not hips Trajectory.Point point = Trajectory.Point.getMedianPoint( this.frameList.GetRange(frameNum - SalamanderController.FramesPerPoint / 2, SalamanderController.FramesPerPoint).ConvertAll( f => (f.boneDataDict[Bone.Type.hips].position.GetXZVector2S()) ) ); fittedTrajectory.points.Add(point); } return(fittedTrajectory); }
private Trajectory ComputeFittedTrajectory() { Trajectory fittedTrajectory = new Trajectory(); for ( int frameNum = CharacterController.FramesPerPoint / 2; frameNum < this.frameList.Count - CharacterController.FramesPerPoint; frameNum += CharacterController.FramesPerPoint ) { // Find the median Point of all the frames in the current sample Trajectory.Point point = Trajectory.Point.getMedianPoint( this.frameList.GetRange(frameNum - CharacterController.FramesPerPoint / 2, CharacterController.FramesPerPoint).ConvertAll( f => (f.boneDataDict[Bone.Type.hips].position.GetXZVector2(), f.boneDataDict[Bone.Type.hips].rotation.eulerAngles) ) ); fittedTrajectory.points.Add(point); } return(fittedTrajectory); }