Exemplo n.º 1
0
        public void CompressEmptySrtKeyFrameAnimation4()
        {
            var random = new Random(12345);

            // Animation with 2 keyframe, which are not Identity.
            var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
            var time0  = TimeSpan.FromTicks(100000);
            var value0 = new SrtTransform(random.NextVector3F(-2, 2), random.NextQuaternionF(), random.NextVector3F(-10, 10));

            var time1  = TimeSpan.FromTicks(200000);
            var value1 = new SrtTransform(random.NextVector3F(-2, 2), random.NextQuaternionF(), random.NextVector3F(-10, 10));

            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time0, value0));
            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time1, value1));

            var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 2, 360, 10);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());

            var defaultSource = SrtTransform.Identity;
            var defaultTarget = SrtTransform.Identity;
            var result        = new SrtTransform();

            srtAnimation.GetValue(time0, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[0].Value, result);

            srtAnimation.GetValue(time1, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[1].Value, result);
        }
Exemplo n.º 2
0
        public void CompressEmptySrtKeyFrameAnimation1()
        {
            // Animation with 1 keyframe, which is Identity.
              var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
              var time = TimeSpan.FromTicks(100000);
              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time, SrtTransform.Identity));

              var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());

              var defaultSource = SrtTransform.Identity;
              var defaultTarget = SrtTransform.Identity;
              var result = new SrtTransform();
              srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[0].Value, result);

              // Only 1 channel is needed.
              int numberOfChannels = 0;
              if (srtAnimation.Scale != null)
            numberOfChannels++;
              if (srtAnimation.Rotation != null)
            numberOfChannels++;
              if (srtAnimation.Translation != null)
            numberOfChannels++;

              Assert.AreEqual(1, numberOfChannels);
        }
Exemplo n.º 3
0
 public void CompressEmptySrtKeyFrameAnimation0()
 {
     // Animation without keyframes.
       var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
       var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);
       Assert.IsNull(srtAnimation);
 }
Exemplo n.º 4
0
        public void CompressEmptySrtKeyFrameAnimation0()
        {
            // Animation without keyframes.
            var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
            var srtAnimation         = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

            Assert.IsNull(srtAnimation);
        }
Exemplo n.º 5
0
        public void CompressEmptySrtKeyFrameAnimation3()
        {
            // Animation with 2 keyframes, which are Identity.
            var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
            var time0 = TimeSpan.FromTicks(100000);
            var time1 = TimeSpan.FromTicks(200000);

            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time0, SrtTransform.Identity));
            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time1, SrtTransform.Identity));

            var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 1, 90, 1);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());

            var defaultSource = SrtTransform.Identity;
            var defaultTarget = SrtTransform.Identity;
            var result        = new SrtTransform();

            srtAnimation.GetValue(time0, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[0].Value, result);

            srtAnimation.GetValue(time1, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[1].Value, result);

            // Only 1 channel is needed.
            int numberOfChannels = 0;

            if (srtAnimation.Scale != null)
            {
                numberOfChannels++;
            }
            if (srtAnimation.Rotation != null)
            {
                numberOfChannels++;
            }
            if (srtAnimation.Translation != null)
            {
                numberOfChannels++;
            }

            Assert.AreEqual(1, numberOfChannels);
        }
Exemplo n.º 6
0
        private static void InsertRandomKeyFrames(Random random, SrtKeyFrameAnimation animation, TimeSpan time0, TimeSpan time1,
                                                  float scaleThreshold, float rotationThreshold, float translationThreshold)
        {
            rotationThreshold = MathHelper.ToRadians(rotationThreshold);
            var defaultSource = SrtTransform.Identity;
            var defaultTarget = SrtTransform.Identity;
            var value         = new SrtTransform();

            int insertionIndex = 0;

            for (int i = 0; i < animation.KeyFrames.Count; i++)
            {
                if (animation.KeyFrames[i].Time == time0)
                {
                    insertionIndex = i + 1;
                    break;
                }
            }

            Debug.Assert(insertionIndex > 0);

            const int numberOfKeyFrames = 2;
            long      tickIncrement     = (time1 - time0).Ticks / (numberOfKeyFrames + 1);

            for (int i = 0; i < numberOfKeyFrames; i++)
            {
                var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);
                Debug.Assert(time0 < time && time < time1);

                // Get interpolated animation value.
                animation.GetValue(time, ref defaultSource, ref defaultTarget, ref value);

                // Apply small variation (within thresholds).
                value.Scale       += random.NextVector3F(-1, 1).Normalized *(scaleThreshold / 2);
                value.Rotation     = QuaternionF.CreateRotation(random.NextVector3F(-1, 1), rotationThreshold / 2) * value.Rotation;
                value.Translation += random.NextVector3F(-1, 1).Normalized *(translationThreshold / 2);

                animation.KeyFrames.Insert(insertionIndex, new KeyFrame <SrtTransform>(time, value));
                insertionIndex++;
            }
        }
Exemplo n.º 7
0
        public void CompressedAnimationShouldHaveSameProperties()
        {
            var srtKeyFrameAnimation = new SrtKeyFrameAnimation
            {
                FillBehavior   = FillBehavior.Hold,
                IsAdditive     = false,
                TargetObject   = null,
                TargetProperty = null
            };

            srtKeyFrameAnimation.KeyFrames.Add(
                new KeyFrame <SrtTransform>(
                    TimeSpan.FromTicks(100000),
                    SrtTransform.Identity));

            var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(FillBehavior.Hold, srtAnimation.FillBehavior);
            Assert.AreEqual(false, srtAnimation.IsAdditive);
            Assert.AreEqual(null, srtAnimation.TargetObject);
            Assert.AreEqual(null, srtAnimation.TargetProperty);

            srtKeyFrameAnimation.FillBehavior   = FillBehavior.Stop;
            srtKeyFrameAnimation.IsAdditive     = true;
            srtKeyFrameAnimation.TargetObject   = "Object XYZ";
            srtKeyFrameAnimation.TargetProperty = "Property XYZ";

            srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(FillBehavior.Stop, srtAnimation.FillBehavior);
            Assert.AreEqual(true, srtAnimation.IsAdditive);
            Assert.AreEqual("Object XYZ", srtAnimation.TargetObject);
            Assert.AreEqual("Property XYZ", srtAnimation.TargetProperty);
        }
Exemplo n.º 8
0
        public void CompressedAnimationShouldHaveSameProperties()
        {
            var srtKeyFrameAnimation = new SrtKeyFrameAnimation
              {
            FillBehavior = FillBehavior.Hold,
            IsAdditive = false,
            TargetObject = null,
            TargetProperty = null
              };

              srtKeyFrameAnimation.KeyFrames.Add(
            new KeyFrame<SrtTransform>(
              TimeSpan.FromTicks(100000),
              SrtTransform.Identity));

              var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(FillBehavior.Hold, srtAnimation.FillBehavior);
              Assert.AreEqual(false, srtAnimation.IsAdditive);
              Assert.AreEqual(null, srtAnimation.TargetObject);
              Assert.AreEqual(null, srtAnimation.TargetProperty);

              srtKeyFrameAnimation.FillBehavior = FillBehavior.Stop;
              srtKeyFrameAnimation.IsAdditive = true;
              srtKeyFrameAnimation.TargetObject = "Object XYZ";
              srtKeyFrameAnimation.TargetProperty = "Property XYZ";

              srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(FillBehavior.Stop, srtAnimation.FillBehavior);
              Assert.AreEqual(true, srtAnimation.IsAdditive);
              Assert.AreEqual("Object XYZ", srtAnimation.TargetObject);
              Assert.AreEqual("Property XYZ", srtAnimation.TargetProperty);
        }
Exemplo n.º 9
0
        public void CompressSrtKeyFrameAnimation()
        {
            var random = new Random(12345);

            float scaleThreshold       = 0.1f;
            float rotationThreshold    = 2; // [°]
            float translationThreshold = 0.2f;

            var srtKeyFrameAnimation = new SrtKeyFrameAnimation();

            // Define a view important keyframes.
            var time0  = TimeSpan.FromTicks(100000);
            var value0 = new SrtTransform(Vector3F.One, QuaternionF.Identity, Vector3F.Zero);

            var time1  = TimeSpan.FromTicks(200000);
            var value1 = new SrtTransform(new Vector3F(2, 2, 2), QuaternionF.CreateRotationX(MathHelper.ToRadians(10)), new Vector3F(1, 1, 1));

            var time2  = TimeSpan.FromTicks(400000);
            var value2 = new SrtTransform(new Vector3F(-1, -1, -1), QuaternionF.CreateRotationX(MathHelper.ToRadians(80)), new Vector3F(10, 10, 10));

            var time3  = TimeSpan.FromTicks(500000);
            var value3 = new SrtTransform(new Vector3F(3, 3, 3), QuaternionF.CreateRotationX(MathHelper.ToRadians(-10)), new Vector3F(-2, -2, -2));

            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time0, value0));
            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time1, value1));
            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time2, value2));
            srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame <SrtTransform>(time3, value3));

            // Add random keyframes within tolerance.
            InsertRandomKeyFrames(random, srtKeyFrameAnimation, time0, time1, scaleThreshold, rotationThreshold, translationThreshold);
            InsertRandomKeyFrames(random, srtKeyFrameAnimation, time1, time2, scaleThreshold, rotationThreshold, translationThreshold);
            InsertRandomKeyFrames(random, srtKeyFrameAnimation, time2, time3, scaleThreshold, rotationThreshold, translationThreshold);

            // ---- Compress animation with tolerance.
            var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, scaleThreshold, rotationThreshold, translationThreshold);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());
            Assert.IsNotNull(srtAnimation.Scale);

            Assert.AreEqual(4, ((KeyFrameAnimation <Vector3F>)srtAnimation.Scale).KeyFrames.Count);
            Assert.AreEqual(4, ((KeyFrameAnimation <QuaternionF>)srtAnimation.Rotation).KeyFrames.Count);
            Assert.AreEqual(4, ((KeyFrameAnimation <Vector3F>)srtAnimation.Translation).KeyFrames.Count);

            var defaultSource = SrtTransform.Identity;
            var defaultTarget = SrtTransform.Identity;
            var result        = new SrtTransform();

            srtAnimation.GetValue(time0, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(value0, result);

            srtAnimation.GetValue(time1, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(value1, result);

            srtAnimation.GetValue(time2, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(value2, result);

            srtAnimation.GetValue(time3, ref defaultSource, ref defaultTarget, ref result);
            Assert.AreEqual(value3, result);

            // Take a view samples.
            const int numberOfSamples = 10;
            long      tickIncrement   = (time3 - time0).Ticks / (numberOfSamples + 1);

            for (int i = 0; i < numberOfSamples; i++)
            {
                var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);

                var valueRef = new SrtTransform();
                srtKeyFrameAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueRef);

                var valueNew = new SrtTransform();
                srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueNew);

                Assert.IsTrue((valueRef.Scale - valueNew.Scale).Length <= scaleThreshold);
                Assert.IsTrue(QuaternionF.GetAngle(valueRef.Rotation, valueNew.Rotation) <= MathHelper.ToRadians(rotationThreshold));
                Assert.IsTrue((valueRef.Translation - valueNew.Translation).Length <= translationThreshold);
            }

            // ----- Compress animation with zero tolerance.
            srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

            Assert.IsNotNull(srtAnimation);
            Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());
            Assert.IsNotNull(srtAnimation.Scale);

            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation <Vector3F>)srtAnimation.Scale).KeyFrames.Count);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation <QuaternionF>)srtAnimation.Rotation).KeyFrames.Count);
            Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation <Vector3F>)srtAnimation.Translation).KeyFrames.Count);

            // Take a view samples.
            for (int i = 0; i < numberOfSamples; i++)
            {
                var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);

                var valueRef = new SrtTransform();
                srtKeyFrameAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueRef);

                var valueNew = new SrtTransform();
                srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueNew);

                Assert.IsTrue(SrtTransform.AreNumericallyEqual(valueRef, valueNew));
            }
        }
Exemplo n.º 10
0
        public void CompressEmptySrtKeyFrameAnimation2()
        {
            var random = new Random(12345);

              // Animation with 1 keyframe, which is not Identity.
              var srtKeyFrameAnimation = new SrtKeyFrameAnimation();
              var time = TimeSpan.FromTicks(100000);
              var value = new SrtTransform(random.NextVector3F(-2, 2), random.NextQuaternionF(), random.NextVector3F(-10, 10));
              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time, value));

              var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 2, 360, 10);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());

              var defaultSource = SrtTransform.Identity;
              var defaultTarget = SrtTransform.Identity;
              var result = new SrtTransform();
              srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(srtKeyFrameAnimation.KeyFrames[0].Value, result);
        }
Exemplo n.º 11
0
        private static void InsertRandomKeyFrames(Random random, SrtKeyFrameAnimation animation, TimeSpan time0, TimeSpan time1,
            float scaleThreshold, float rotationThreshold, float translationThreshold)
        {
            rotationThreshold = MathHelper.ToRadians(rotationThreshold);
              var defaultSource = SrtTransform.Identity;
              var defaultTarget = SrtTransform.Identity;
              var value = new SrtTransform();

              int insertionIndex = 0;
              for (int i = 0; i < animation.KeyFrames.Count; i++)
              {
            if (animation.KeyFrames[i].Time == time0)
            {
              insertionIndex = i + 1;
              break;
            }
              }

              Debug.Assert(insertionIndex > 0);

              const int numberOfKeyFrames = 2;
              long tickIncrement = (time1 - time0).Ticks / (numberOfKeyFrames + 1);
              for (int i = 0; i < numberOfKeyFrames; i++)
              {
            var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);
            Debug.Assert(time0 < time && time < time1);

            // Get interpolated animation value.
            animation.GetValue(time, ref defaultSource, ref defaultTarget, ref value);

            // Apply small variation (within thresholds).
            value.Scale += random.NextVector3F(-1, 1).Normalized * (scaleThreshold / 2);
            value.Rotation = QuaternionF.CreateRotation(random.NextVector3F(-1, 1), rotationThreshold / 2) * value.Rotation;
            value.Translation += random.NextVector3F(-1, 1).Normalized * (translationThreshold / 2);

            animation.KeyFrames.Insert(insertionIndex, new KeyFrame<SrtTransform>(time, value));
            insertionIndex++;
              }
        }
Exemplo n.º 12
0
        public void CompressSrtKeyFrameAnimation()
        {
            var random = new Random(12345);

              float scaleThreshold = 0.1f;
              float rotationThreshold = 2;  // [°]
              float translationThreshold = 0.2f;

              var srtKeyFrameAnimation = new SrtKeyFrameAnimation();

              // Define a view important keyframes.
              var time0 = TimeSpan.FromTicks(100000);
              var value0 = new SrtTransform(Vector3F.One, QuaternionF.Identity, Vector3F.Zero);

              var time1 = TimeSpan.FromTicks(200000);
              var value1 = new SrtTransform(new Vector3F(2, 2, 2), QuaternionF.CreateRotationX(MathHelper.ToRadians(10)), new Vector3F(1, 1, 1));

              var time2 = TimeSpan.FromTicks(400000);
              var value2 = new SrtTransform(new Vector3F(-1, -1, -1), QuaternionF.CreateRotationX(MathHelper.ToRadians(80)), new Vector3F(10, 10, 10));

              var time3 = TimeSpan.FromTicks(500000);
              var value3 = new SrtTransform(new Vector3F(3, 3, 3), QuaternionF.CreateRotationX(MathHelper.ToRadians(-10)), new Vector3F(-2, -2, -2));

              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time0, value0));
              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time1, value1));
              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time2, value2));
              srtKeyFrameAnimation.KeyFrames.Add(new KeyFrame<SrtTransform>(time3, value3));

              // Add random keyframes within tolerance.
              InsertRandomKeyFrames(random, srtKeyFrameAnimation, time0, time1, scaleThreshold, rotationThreshold, translationThreshold);
              InsertRandomKeyFrames(random, srtKeyFrameAnimation, time1, time2, scaleThreshold, rotationThreshold, translationThreshold);
              InsertRandomKeyFrames(random, srtKeyFrameAnimation, time2, time3, scaleThreshold, rotationThreshold, translationThreshold);

              // ---- Compress animation with tolerance.
              var srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, scaleThreshold, rotationThreshold, translationThreshold);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());
              Assert.IsNotNull(srtAnimation.Scale);

              Assert.AreEqual(4, ((KeyFrameAnimation<Vector3F>)srtAnimation.Scale).KeyFrames.Count);
              Assert.AreEqual(4, ((KeyFrameAnimation<QuaternionF>)srtAnimation.Rotation).KeyFrames.Count);
              Assert.AreEqual(4, ((KeyFrameAnimation<Vector3F>)srtAnimation.Translation).KeyFrames.Count);

              var defaultSource = SrtTransform.Identity;
              var defaultTarget = SrtTransform.Identity;
              var result = new SrtTransform();
              srtAnimation.GetValue(time0, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(value0, result);

              srtAnimation.GetValue(time1, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(value1, result);

              srtAnimation.GetValue(time2, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(value2, result);

              srtAnimation.GetValue(time3, ref defaultSource, ref defaultTarget, ref result);
              Assert.AreEqual(value3, result);

              // Take a view samples.
              const int numberOfSamples = 10;
              long tickIncrement = (time3 - time0).Ticks / (numberOfSamples + 1);
              for (int i = 0; i < numberOfSamples; i++)
              {
            var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);

            var valueRef = new SrtTransform();
            srtKeyFrameAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueRef);

            var valueNew = new SrtTransform();
            srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueNew);

            Assert.IsTrue((valueRef.Scale - valueNew.Scale).Length <= scaleThreshold);
            Assert.IsTrue(QuaternionF.GetAngle(valueRef.Rotation, valueNew.Rotation) <= MathHelper.ToRadians(rotationThreshold));
            Assert.IsTrue((valueRef.Translation - valueNew.Translation).Length <= translationThreshold);
              }

              // ----- Compress animation with zero tolerance.
              srtAnimation = AnimationHelper.Compress(srtKeyFrameAnimation, 0, 0, 0);

              Assert.IsNotNull(srtAnimation);
              Assert.AreEqual(srtKeyFrameAnimation.GetTotalDuration(), srtAnimation.GetTotalDuration());
              Assert.IsNotNull(srtAnimation.Scale);

              Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation<Vector3F>)srtAnimation.Scale).KeyFrames.Count);
              Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation<QuaternionF>)srtAnimation.Rotation).KeyFrames.Count);
              Assert.AreEqual(srtKeyFrameAnimation.KeyFrames.Count, ((KeyFrameAnimation<Vector3F>)srtAnimation.Translation).KeyFrames.Count);

              // Take a view samples.
              for (int i = 0; i < numberOfSamples; i++)
              {
            var time = TimeSpan.FromTicks(time0.Ticks + (i + 1) * tickIncrement);

            var valueRef = new SrtTransform();
            srtKeyFrameAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueRef);

            var valueNew = new SrtTransform();
            srtAnimation.GetValue(time, ref defaultSource, ref defaultTarget, ref valueNew);

            Assert.IsTrue(SrtTransform.AreNumericallyEqual(valueRef, valueNew));
              }
        }