Ejemplo n.º 1
0
        public void TryNormalize()
        {
            VectorF v = new VectorF(4);
              bool normalized = v.TryNormalize();
              Assert.IsFalse(normalized);

              v = new VectorF(new float[] { 1, 2, 3, 4 });
              normalized = v.TryNormalize();
              Assert.IsTrue(normalized);
              Assert.AreEqual(new VectorF(new float[] { 1, 2, 3, 4 }).Normalized, v);

              v = new VectorF(new float[] { 0, -1, 0, 0 });
              normalized = v.TryNormalize();
              Assert.IsTrue(normalized);
              Assert.AreEqual(new VectorF(new float[] { 0, -1, 0, 0 }).Normalized, v);
        }