コード例 #1
0
 @Test
 public void testRoom() {
   FakeBlockCache bc = new FakeBlockCache();
   bc.room(-1, 64, -1, 1, 66, 1, Material.STONE);
   double[] middle = new double[] {0.5, 65.5, 0.5}; // Free spot.
   PassableRayTracing rt = new PassableRayTracing();
   rt.setBlockCache(bc);
   boolean intense = BuildParameters.testLevel > 1;
   for (double x = -0.5; x < 1.0; x += 0.5) {
     for (double y = -0.5; y < 1.0; y += 0.5) {
       for (double z = -0.5; z < 1.0; z += 0.5) {
         double add = Math.abs(x) + Math.abs(y) + Math.abs(z);
         TestRayTracing.runCenterRays(
             rt,
             middle[0] + x,
             middle[1] + y,
             middle[2] + z,
             2.0 + add,
             intense ? 10000 : 1000,
             true,
             false,
             true);
       }
     }
   }
   rt.cleanup();
   bc.cleanup();
 }
コード例 #2
0
 @Test
 public void testRoom() {
   // TODO: Test for differing middle points (negative to positive range, random, selected rays).
   FakeBlockCache bc = new FakeBlockCache();
   bc.room(-1, 64, -1, 1, 66, 1, Material.STONE);
   // Note that reversed checks are slightly different with the centered version, but start + end
   // blocks are air anyway.
   double[] middle = new double[] {0.5, 65.5, 0.5}; // Free spot.
   // TODO: Must work with strict set to false.
   CenteredInteractRayTracing rt = new CenteredInteractRayTracing(false, 0, 65, 0);
   // CenteredInteractRayTracing rt = new CenteredInteractRayTracing(true, 0, 65, 0);
   rt.setBlockCache(bc);
   double[][] pastFailures =
       new double[][] {
         {2.1393379885667643, 67.18197661625649, 1.7065201483677281, 0.0, 65.0, 0.0},
         {2.7915547712543676, 66.65545738305906, 1.310222428430474, 0.0, 65.0, 0.0},
         {0.0, 65.0, 4.5, 0.0, 65.0, 1.0}, // strict is false.
         {-3.5, 61.5, -3.5, 0.0, 65.0, 0.0} // strict is false.
       };
   TestRayTracing.runCoordinates(rt, pastFailures, true, false, 3, true);
   boolean intense = BuildParameters.testLevel > 1;
   for (double x = -0.5; x < 1.0; x += 0.5) {
     for (double y = -0.5; y < 1.0; y += 0.5) {
       for (double z = -0.5; z < 1.0; z += 0.5) {
         double add = Math.abs(x) + Math.abs(y) + Math.abs(z);
         TestRayTracing.runCenterRays(
             rt,
             middle[0] + x,
             middle[1] + y,
             middle[2] + z,
             2.0 + add,
             intense ? 10000 : 1000,
             true,
             false,
             true);
       }
     }
   }
   rt.cleanup();
   bc.cleanup();
 }