Beispiel #1
0
 public void ProjectToException1()
 {
     VectorF v = new VectorF(1);
       v.ProjectTo(null);
 }
Beispiel #2
0
        public void ProjectTo2()
        {
            VectorF unitX = new VectorF(new float[] { 1, 0, 0, 0 });
              VectorF unitY = new VectorF(new float[] { 0, 1, 0, 0 });
              VectorF unitZ = new VectorF(new float[] { 0, 0, 1, 0 });
              VectorF one = new VectorF(new float[] { 1, 1, 1, 1 });

              // Project (1, 1, 1) to axes
              VectorF projection = new VectorF(new float[] { 1, 1, 1, 0 });
              projection.ProjectTo(unitX);
              Assert.AreEqual(unitX, projection);
              projection.Set(one);
              projection.ProjectTo(unitY);
              Assert.AreEqual(unitY, projection);
              projection.Set(one);
              projection.ProjectTo(unitZ);
              Assert.AreEqual(unitZ, projection);

              // Project axes to (1, 1, 1)
              VectorF expected = new VectorF(new float[] { 1, 1, 1, 0 }) / 3.0f;
              projection.Set(unitX);
              projection.ProjectTo(new VectorF(new float[] { 1, 1, 1, 0 }));
              Assert.AreEqual(expected, projection);
              projection.Set(unitY);
              projection.ProjectTo(new VectorF(new float[] { 1, 1, 1, 0 }));
              Assert.AreEqual(expected, projection);
              projection.Set(unitZ);
              projection.ProjectTo(new VectorF(new float[] { 1, 1, 1, 0 }));
              Assert.AreEqual(expected, projection);
        }