Пример #1
0
        public void TryNormalize()
        {
            VectorD v = new VectorD(4);
              bool normalized = v.TryNormalize();
              Assert.IsFalse(normalized);

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

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