Exemple #1
0
            public void self_angle_is_zero()
            {
                var vector   = new Vector4F(10.0f, 57, -9, 10);
                var expected = 0.0f;

                var actual = vector.GetAngleBetween(vector);

                Assert.Equal(expected, actual);
            }
Exemple #2
0
            public void example_2()
            {
                var left     = new Vector4F(1.0f, 3.0f, 4.0f, 9.0f);
                var right    = new Vector4F(-2.0f, 5.6f, -9.0f, 0.1f);
                var expected = 1.7537363654297111f;

                var actual = left.GetAngleBetween(right);

                Assert.Equal(expected, actual, 10);
            }
Exemple #3
0
            public void example_1()
            {
                var left     = new Vector4F(1.0f, 0, 0, 0);
                var right    = new Vector4F(1.0f, 0, 1, 0);
                var expected = (float)Math.Acos(1.0 / Math.Sqrt(2.0));

                var actual = left.GetAngleBetween(right);

                Assert.Equal(expected, actual, 5);
            }
Exemple #4
0
            public void opposite_vector_angle_is_pi()
            {
                var left     = new Vector4F(14.0f, 98, -19, 88);
                var right    = left.GetNegative();
                var expected = (float)Math.PI;

                var actual = left.GetAngleBetween(right);

                Assert.Equal(expected, actual, 10);
            }
Exemple #5
0
            public void right_angle_is_half_pi()
            {
                var left     = new Vector4F(1.0f, 0, 1, 0);
                var right    = new Vector4F(0.0f, 1, 0, 1);
                var expected = (float)(Math.PI / 2.0);

                var actual = left.GetAngleBetween(right);

                Assert.Equal(expected, actual, 10);
            }