Пример #1
0
            public void can_get_scaled_vector()
            {
                var source   = new Vector4F(1.0f, -2, 4, -9);
                var expected = new Vector4F(3.0f, -6, 12, -27);

                var actual = source.GetScaled(3.0f);

                Assert.Equal(expected, actual);
            }
Пример #2
0
            public void source_vector_is_unchanged()
            {
                var actual   = new Vector4F(1.0f, 2, 4, -9);
                var expected = new Vector4F(actual);

                var result = actual.GetScaled(2.0f);

                Assert.Equal(expected, actual);
            }
Пример #3
0
            public void projection_example_1()
            {
                var u        = new Vector4F(-1.0f, 2, 1, 3);
                var v        = new Vector4F(2.0f, -1, 3, 1);
                var expected = u.GetScaled(2.0f / 15.0f);

                var actual = u.GetProjected(v);

                Assert.Equal(expected, actual);
            }
Пример #4
0
            public void op_multiply_scalar_mimics_scale_first()
            {
                var vector   = new Vector4F(1.0f, 2, 3, 4);
                var scalar   = 2.4f;
                var expected = vector.GetScaled(scalar);

                var actual = scalar * vector;

                Assert.Equal(expected, actual);
            }