public void can_divide_vector() { var actual = new Vector4D(3, -2, 8, 1.5); var expected = new Vector4D(3.0 / 4.0, -2 / 4.0, 8 / 4.0, 1.5 / 4.0); actual.Divide(4); Assert.Equal(expected, actual); }
public void Division() { double x = 23.4; double y = -11.0; double z = 7.0; double w = 1.9; double s = 13.3; Vector4D v = new Vector4D(x, y, z, w); Vector4D u = Vector4D.Divide(v, s); Assert.IsTrue(Numeric.AreEqual(x / s, u.X)); Assert.IsTrue(Numeric.AreEqual(y / s, u.Y)); Assert.IsTrue(Numeric.AreEqual(z / s, u.Z)); Assert.IsTrue(Numeric.AreEqual(w / s, u.W)); }
public void DivisionVector() { double x1 = 23.4; double y1 = -11.0; double z1 = 6.0; double w1 = 0.2; double x2 = 34.0; double y2 = 1.2; double z2 = -6.0; double w2 = -0.2; Vector4D v = new Vector4D(x1, y1, z1, w1); Vector4D w = new Vector4D(x2, y2, z2, w2); Assert.AreEqual(new Vector4D(x1 / x2, y1 / y2, z1 / z2, w1 / w2), Vector4D.Divide(v, w)); }
public void Divide() { Vector4D v1 = new Vector4D(10.0, 20.0, 30.0, 40.0); Vector4D v2 = v1 / 5.0; Assert.AreEqual(2.0, v2.X, 1e-14); Assert.AreEqual(4.0, v2.Y, 1e-14); Assert.AreEqual(6.0, v2.Z, 1e-14); Assert.AreEqual(8.0, v2.W, 1e-14); Vector4D v3 = v1.Divide(5.0); Assert.AreEqual(2.0, v3.X, 1e-14); Assert.AreEqual(4.0, v3.Y, 1e-14); Assert.AreEqual(6.0, v3.Z, 1e-14); Assert.AreEqual(8.0, v3.W, 1e-14); }