public void self_angle_is_zero() { var vector = new Vector4D(10, 57, -9, 10); var expected = 0.0; var actual = vector.GetAngleBetween(vector); Assert.Equal(expected, actual); }
public void example_2() { var left = new Vector4D(1, 3, 4, 9); var right = new Vector4D(-2, 5.6, -9, 0.1); var expected = 1.7537363654297111; var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }
public void example_1() { var left = new Vector4D(1, 0, 0, 0); var right = new Vector4D(1, 0, 1, 0); var expected = Math.Acos(1.0 / Math.Sqrt(2.0)); var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }
public void opposite_vector_angle_is_pi() { var left = new Vector4D(14, 98, -19, 88); var right = left.GetNegative(); var expected = Math.PI; var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }
public void right_angle_is_half_pi() { var left = new Vector4D(1, 0, 1, 0); var right = new Vector4D(0, 1, 0, 1); var expected = Math.PI / 2.0; var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }