コード例 #1
0
        public void StepDoublePrecision()
        {
            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 2.0, 0.0, StepInterpolation.Left));
            Assert.AreEqual(2, InterpolationHelper.Step(1.0, 2.0, 0.5, StepInterpolation.Left));
            Assert.AreEqual(2, InterpolationHelper.Step(1.0, 2.0, 1.0, StepInterpolation.Left));

            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 2.0, 0.0, StepInterpolation.Right));
            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 2.0, 0.5, StepInterpolation.Right));
            Assert.AreEqual(2, InterpolationHelper.Step(1.0, 2.0, 1.0, StepInterpolation.Right));

            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 2.0, 0.0, StepInterpolation.Centered));
            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 2.0, 0.3, StepInterpolation.Centered));
            Assert.AreEqual(2, InterpolationHelper.Step(1.0, 2.0, 0.6, StepInterpolation.Centered));
            Assert.AreEqual(2, InterpolationHelper.Step(1.0, 2.0, 1.0, StepInterpolation.Centered));
            Assert.AreEqual(1, InterpolationHelper.Step(1.0, 10.0, 0.4, StepInterpolation.Centered));
            Assert.AreEqual(10, InterpolationHelper.Step(1.0, 10.0, 0.6, StepInterpolation.Centered));
        }
コード例 #2
0
        public void StepSinglePrecision()
        {
            Assert.AreEqual(1, InterpolationHelper.Step(1, 2, 0, StepInterpolation.Left));
            Assert.AreEqual(2, InterpolationHelper.Step(1, 2, 0.5f, StepInterpolation.Left));
            Assert.AreEqual(2, InterpolationHelper.Step(1, 2, 1, StepInterpolation.Left));

            Assert.AreEqual(1, InterpolationHelper.Step(1, 2, 0, StepInterpolation.Right));
            Assert.AreEqual(1, InterpolationHelper.Step(1, 2, 0.5f, StepInterpolation.Right));
            Assert.AreEqual(2, InterpolationHelper.Step(1, 2, 1, StepInterpolation.Right));

            Assert.AreEqual(1, InterpolationHelper.Step(1, 2, 0, StepInterpolation.Centered));
            Assert.AreEqual(1, InterpolationHelper.Step(1, 2, 0.3f, StepInterpolation.Centered));
            Assert.AreEqual(2, InterpolationHelper.Step(1, 2, 0.6f, StepInterpolation.Centered));
            Assert.AreEqual(2, InterpolationHelper.Step(1, 2, 1, StepInterpolation.Centered));
            Assert.AreEqual(1, InterpolationHelper.Step(1, 10, 0.4f, StepInterpolation.Centered));
            Assert.AreEqual(10, InterpolationHelper.Step(1, 10, 0.6f, StepInterpolation.Centered));
        }
コード例 #3
0
 /// <summary>
 /// Computes a point on the curve.
 /// </summary>
 /// <param name="parameter">The curve parameter.</param>
 /// <returns>The curve point.</returns>
 public Vector2F GetPoint(float parameter)
 {
     return(InterpolationHelper.Step(Point1, Point2, parameter, StepType));
 }