Esempio n. 1
0
        private static void AssertCurveMatchesSavedSamples(Curve <Single> curve, String filename)
        {
            var expectedSamples = CurveTestUtils.ReadSamplesFromCsv <Single>(GetResourcePath(filename));

            foreach (var expectedSample in expectedSamples)
            {
                var actualSampleValue = curve.Evaluate(expectedSample.Position, default);
                Assert.AreEqual(expectedSample.Value, actualSampleValue, 0.0001f, $"Sample mismatch at curve position {expectedSample.Position}.");
            }
        }
Esempio n. 2
0
        private static void AssertCurveMatchesSavedSamples(Curve <Vector3> curve, String filename)
        {
            var expectedSamples = CurveTestUtils.ReadSamplesFromCsv <Vector3>(GetResourcePath(filename));

            foreach (var expectedSample in expectedSamples)
            {
                var expectedSampleValue = Vector3.Normalize(expectedSample.Value);
                var actualSampleValue   = Vector3.Normalize(curve.Evaluate(expectedSample.Position, default));
                Assert.AreEqual(expectedSampleValue.X, actualSampleValue.X, 0.0001f, $"Sample mismatch at curve position {expectedSample.Position}.");
                Assert.AreEqual(expectedSampleValue.Y, actualSampleValue.Y, 0.0001f, $"Sample mismatch at curve position {expectedSample.Position}.");
                Assert.AreEqual(expectedSampleValue.Z, actualSampleValue.Z, 0.0001f, $"Sample mismatch at curve position {expectedSample.Position}.");
            }
        }
Esempio n. 3
0
        public void Curve_MatchesExpectedSampleValues_WhenTypeIsVector3_AndContinuityIsCubicSpline()
        {
            var curve = CurveTestUtils.ReadCurveFromCsv(GetResourcePath("Vector3Curve_CubicSpline_keys.csv"), Vector3CurveCubicSplineSampler.Instance);

            AssertCurveMatchesSavedSamples(curve, "Vector3Curve_CubicSpline_samples.csv");
        }
Esempio n. 4
0
        public void Curve_MatchesExpectedSampleValues_WhenTypeIsSingle_AndContinuityIsLinear()
        {
            var curve = CurveTestUtils.ReadCurveFromCsv(GetResourcePath("SingleCurve_Linear_keys.csv"), SingleCurveLinearSampler.Instance);

            AssertCurveMatchesSavedSamples(curve, "SingleCurve_Linear_samples.csv");
        }
Esempio n. 5
0
        public void Curve_MatchesExpectedSampleValues_WhenTypeIsQuaternion_AndContinuityIsStep()
        {
            var curve = CurveTestUtils.ReadCurveFromCsv(GetResourcePath("QuaternionCurve_Step_keys.csv"), QuaternionCurveStepSampler.Instance);

            AssertCurveMatchesSavedSamples(curve, "QuaternionCurve_Step_samples.csv");
        }