public void example_2() { var left = new VectorD(new[] { 1.0, 3, 4, 9, -13 }); var right = new VectorD(new[] { -2, 5.6, -9, 0.1, 5 }); var expected = 2.017320409990204; var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }
public void example_1() { var left = new VectorD(5); left.Set(0, 1); var right = new VectorD(5); right.Set(0, 1); right.Set(2, 1); var expected = Math.Acos(1.0 / Math.Sqrt(2.0)); var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }
public void right_angle_is_half_pi() { var left = new VectorD(4); left.Set(0, 1); left.Set(2, 1); var right = new VectorD(4); right.Set(1, 1); right.Set(3, 1); var expected = Math.PI / 2.0; var actual = left.GetAngleBetween(right); Assert.Equal(expected, actual, 10); }