Esempio n. 1
0
        public void VelocityNormalized()
        {
            var p0 = new Vector2(-4, -4);
            var p1 = new Vector2(2, -4);
            var p2 = new Vector2(4, 4);

            var myCurve = new QuadraticBezierCurve2D(p0, p1, p2);

            myCurve.Velocity(2, 1, 5).Should().BeEquivalentTo(new Vector2(10f, 3.9999998f));
            myCurve.Velocity(8, 2, 10).Should().BeEquivalentTo(new Vector2(6, 12));

            myCurve.Invoking(x => x.Velocity(15, 2, 5)).Should().Throw <ArgumentException>();
        }
Esempio n. 2
0
        public void VelocityNormalized()
        {
            var p0 = new Vector2(-4, -4);
            var p1 = new Vector2(2, -4);
            var p2 = new Vector2(4, 4);

            QuadraticBezierCurve2D.Velocity(p0, p1, p2, 2, 1, 5).Should().BeEquivalentTo(new Vector2(10f, 3.9999998f));
            QuadraticBezierCurve2D.Velocity(p0, p1, p2, 8, 2, 10).Should().BeEquivalentTo(new Vector2(6, 12f));

            Action invalidTime = () => QuadraticBezierCurve2D.Velocity(p0, p1, p1, 15, 2, 5);

            invalidTime.Should().Throw <ArgumentException>();
        }