예제 #1
0
 public void TestInvTransform()
 {
     for(int i = 0x00; i < TestParameters.PointTest; i++) {
         Point3 p = Point3.Random();
         Matrix4 M = new Matrix4(Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble(),
                                 Maths.RandomGenerator.NextDouble());
         Point3 q = new Point3(p);
         q.Transform(M);
         q.InvTransform(M);
         Assert.IsTrue(Math.Abs(p.X-q.X) <= Maths.GlobalEpsilon);
         Assert.IsTrue(Math.Abs(p.Y-q.Y) <= Maths.GlobalEpsilon);
         Assert.IsTrue(Math.Abs(p.Z-q.Z) <= Maths.GlobalEpsilon);
     }
 }