public void When_NormalizeTwice_Expect_Same(double x, double y, double z) { Vect3 v1 = new Vect3(x, y, z); v1 = v1.GetNormalized(); Vect3 v2 = v1.GetNormalized(); Assert.That(Util.NearlyEqual(v1.Length(), 1)); Assert.That(Util.NearlyEqual(v2.Length(), 1)); Assert.AreEqual(v1, v2); }
public void When_CrossWithNormalPlane_Expect_StartVector() { Vect3 vect1 = new Vect3(1, 2, 3); Tuple <Vect3, Vect3> plane = vect1.GetNormalPlane(); Vect3 vect2 = Vect3.Cross(plane.Item1, plane.Item2); Assert.AreEqual(vect1.GetNormalized(), vect2.GetNormalized()); }
public void When_NormalizeSmaller_Expect_Normal() { Vect3 vect1 = new Vect3(0.1d, 0.1d, 0); Vect3 vect2 = new Vect3(1 / Math.Sqrt(2), 1 / Math.Sqrt(2), 0); vect1 = vect1.GetNormalized(); Assert.AreEqual(vect1, vect2); Assert.That(Util.NearlyEqual(1, vect1.Length())); }
private void When_NormalizeZero_Expect_Exception_Helper() { Vect3 vect = Vect3.Zero; vect.GetNormalized(); }