Пример #1
0
 private static void UpdateAnimation(ref Channel animationChannel, ref KeyFrameData <T> animationValue)
 {
     animationChannel.ValuePrev  = animationChannel.ValueStart;
     animationChannel.ValueStart = animationChannel.ValueEnd;
     animationChannel.ValueEnd   = animationChannel.ValueNext;
     animationChannel.ValueNext  = animationValue;
 }
Пример #2
0
 internal static void UpdateAnimation(ref EvaluatorData animationChannel, ref KeyFrameData <float> animationValue)
 {
     animationChannel.ValuePrev  = animationChannel.ValueStart;
     animationChannel.ValueStart = animationChannel.ValueEnd;
     animationChannel.ValueEnd   = animationChannel.ValueNext;
     animationChannel.ValueNext  = animationValue;
 }
Пример #3
0
        /// <summary>
        /// Evaluates the error within specified segment.
        /// </summary>
        /// <param name="originalCurve">The original curve.</param>
        /// <param name="evaluator">The evaluator.</param>
        /// <param name="stepSize">Size of the step.</param>
        /// <param name="keyFrame">The key frame.</param>
        /// <param name="nextKeyFrame">The next key frame.</param>
        /// <returns></returns>
        private KeyValuePair <CompressedTimeSpan, float> EvaluateError(Func <CompressedTimeSpan, float> originalCurve, Evaluator evaluator, CompressedTimeSpan stepSize, KeyFrameData <float> keyFrame, KeyFrameData <float> nextKeyFrame)
        {
            var startTime = keyFrame.Time;
            var endTime   = nextKeyFrame.Time;

            var biggestDifference     = 0.0f;
            var biggestDifferenceTime = startTime;

            // Rounds up start time (i.e. startTime is multiple of stepSize)
            startTime = new CompressedTimeSpan((startTime.Ticks / stepSize.Ticks + 1) * stepSize.Ticks);

            for (var time = startTime; time < endTime; time += stepSize)
            {
                var difference = Math.Abs(originalCurve(time) - evaluator.Evaluate(time));

                if (difference > biggestDifference)
                {
                    biggestDifference     = difference;
                    biggestDifferenceTime = time;
                }
            }
            return(new KeyValuePair <CompressedTimeSpan, float>(biggestDifferenceTime, biggestDifference));
        }