public void orthogonalProjection_Self() { vector = new Vector(1.0, 2.0, 3.0); Assert.IsTrue(vector.Equals(vector.orthogonalProjection(vector))); }
public void equalityTest_PerValue() { vector = new Vector(1.0, 2.0, 3.0); vector2 = new Vector(1.0, 2.0, 3.0); Assert.IsTrue(vector.Equals(vector2)); vector2 = new Vector(0.0, 2.0, 3.0); Assert.IsFalse(vector.Equals(vector2)); vector2 = new Vector(1.0, 0.0, 3.0); Assert.IsFalse(vector.Equals(vector2)); vector2 = new Vector(1.0, 2.0, 0.0); Assert.IsFalse(vector.Equals(vector2)); }
public void orthogonalProjection_NegativeValues() { vector = new Vector(1.0, 2.0, 3.0); vector2 = new Vector(-4.0, -25.0, -1.0); double fraction = vector.dotProduct(vector2)/vector2.dotProduct(vector2); Vector newVector = new Vector (fraction*(-4.0), (-25.0) * fraction, (-1.0)* fraction); Assert.IsTrue(newVector.Equals(vector.orthogonalProjection(vector2))); }
public void equalityTest_Logic() { vector = new Vector(1.0, 2.0, 3.0); vector2 = new Vector(15.0, 6.0, 0.0); Assert.IsTrue(vector.Equals(vector)); Assert.AreEqual(vector.Equals(vector2), vector2.Equals(vector)); Assert.IsFalse(vector.Equals(null)); }