public void zero_size_vector_has_zero_squared_magnitude() { var vector = new VectorF(0); var expected = 0.0; var actual = vector.GetMagnitude(); Assert.Equal(expected, actual); }
public void can_normalize_sample() { var vector = new VectorF(new[] { 3.0f, 4, 5, -6 }); var expected = vector.GetQuotient(vector.GetMagnitude()); var actual = vector.GetNormal(); Assert.Equal(expected, actual); }
public void negative_values_produce_same_magnitude() { var vector = new VectorF(3); vector.Set(0, 3); vector.Set(1, -4); vector.Set(2, 5); var expected = vector.GetMagnitude(); var actual = vector.GetNegative().GetMagnitude(); Assert.Equal(expected, actual); }
public void can_get_magnitude() { var vector = new VectorF(3); vector.Set(0, 3f); vector.Set(1, -4f); vector.Set(2, 5f); var expected = (float)Math.Sqrt(50.0f); var actual = vector.GetMagnitude(); Assert.Equal(expected, actual); }