Package cofh.repack.codechicken.lib.vec

Examples of cofh.repack.codechicken.lib.vec.CuboidCoord


      sides = 0;
    }

    public static boolean intersects(QBCuboid a, QBCuboid b) {

      CuboidCoord c = a.c;
      CuboidCoord d = b.c;
      return c.min.x <= d.max.x && d.min.x <= c.max.x && c.min.y <= d.max.y && d.min.y <= c.max.y && c.min.z <= d.max.z && d.min.z <= c.max.z;
    }
View Full Code Here


      }
    }

    public void clip(QBCuboid o) {

      CuboidCoord d = o.c;
      for (int a = 0; a < 6; a += 2) {
        int a1 = (a + 2) % 6;
        int a2 = (a + 4) % 6;
        if (c.getSide(a1 + 1) <= d.getSide(a1 + 1) && c.getSide(a1) >= d.getSide(a1) && c.getSide(a2 + 1) <= d.getSide(a2 + 1)
            && c.getSide(a2) >= d.getSide(a2)) {

          if (c.getSide(a) <= d.getSide(a + 1) && c.getSide(a) >= d.getSide(a)) {
            c.setSide(a, d.getSide(a + 1) + 1);
            sides |= 1 << a;
          }
          if (c.getSide(a + 1) >= d.getSide(a) && c.getSide(a + 1) <= d.getSide(a + 1)) {
            c.setSide(a + 1, d.getSide(a) - 1);
            sides |= 2 << a;
          }
        }
      }
    }
View Full Code Here

      return true;
    }

    private QBCuboid expand(boolean[][][] solid, BlockCoord b) {

      CuboidCoord c = new CuboidCoord(b);
      solid[b.x][b.y][b.z] = false;

      for (int s = 0; s < 6; s++) {
        CuboidCoord slice = c.copy();
        slice.expand(s ^ 1, -(slice.size(s) - 1));
        slice.expand(s, 1);

        while (slice.getSide(s) >= 0 && slice.getSide(s) < size.getSide(s)) {
          if (!voxelFull(solid, slice)) {
            break;
          }
          slice.expand(s ^ 1, -1);
          slice.expand(s, 1);
          c.expand(s, 1);
        }
      }
      return new QBCuboid(this, c);
    }
View Full Code Here

TOP

Related Classes of cofh.repack.codechicken.lib.vec.CuboidCoord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.