Package Hexel.math

Examples of Hexel.math.Vector2i


    super(new BlockHeightMapGenerator(cleanup));
  }

  @Override
  public Vector2i copyKey(Vector2i key) {
    return new Vector2i(key);
  }
View Full Code Here


    try {
      HeightMap h = this.hmapCache.getIfPresent(p);
      if (h != null)
        return h;
      else
        return this.hmapCache.get(new Vector2i(p));
    } catch (Exception e) {
      System.out.println("Caught Exception retrieving height map from cache!");
      e.printStackTrace();
      System.exit(1);
      return null;
View Full Code Here

      this.locks[i] = new Object();
    }
  }

  public PlateChunk get(int x, int y) {
    return this.get(new Vector2i(x, y));
  }
View Full Code Here

      this.locks[i] = new Object();
    }
  }

  public int[][] get(int x, int y) {
    return this.get(new Vector2i(x, y));
  }
View Full Code Here

      }
      tx = minx;
      ty = miny;
    }

    return new Vector2i(tx, ty);
  }
View Full Code Here

      this.locks[i] = new Object();
    }
  }

  public int[][] get(int x, int y) {
    return this.get(new Vector2i(x, y));
  }
View Full Code Here

      this.locks[i] = new Object();
    }
  }

  public PlateSumChunk get(int x, int y) {
    return this.get(new Vector2i(x, y));
  }
View Full Code Here

public class PlateGrid {

  public static void wavefront(int[][] grid, int x, int y) {
    Queue<Vector2i> toUpdate = new LinkedList<Vector2i>();

    toUpdate.add(new Vector2i(x, y));

    while (!toUpdate.isEmpty()) {
      Vector2i p = toUpdate.poll();
      int val = grid[p.x][p.y];
      for (int dx = -1; dx <= 1; dx++) {
        for (int dy = -1; dy <= 1; dy++) {
          int lx = p.x + dx;
          int ly = p.y + dy;
          if (lx < 0 || ly < 0 || lx >= PlateChunk.WIDTH
              || ly >= PlateChunk.HEIGHT)
            continue;
          if (val + 1 < grid[lx][ly]) {
            grid[lx][ly] = 1 + minNeighbor(grid, lx, ly);
            toUpdate.add(new Vector2i(lx, ly));
          }

        }
      }
    }
View Full Code Here

  public BlockHeightMap gen(Vector2i bhmp) {
    int bhmx = bhmp.x * 2;
    int bhmy = bhmp.y * 2;
    BlockHeightMap bhm = new BlockHeightMap();

    Vector2i tmp = new Vector2i();

    int[][] heights = new int[3][3];
    for (int x = 0; x <= 2; x++) {
      for (int y = 0; y <= 2; y++) {
        heights[x][y] = this.shmcs.getHeight(bhmx + x, bhmy + y, tmp);
View Full Code Here

    PlateGrid.wavefront(grid, 0, 0);

    while (true) {
      int plateDist = (int) Math.max(minPlateDist,
          avgPlateDist + random.nextGaussian() * plateDistStdDev);
      Vector2i p = select(random, grid, plateDist);
      if (p == null)
        break;
      grid[p.x][p.y] = 0;
      PlateGrid.wavefront(grid, p.x, p.y);
    }

    Vector2i p = new Vector2i();
    for (int x = 0; x < PlateChunk.WIDTH; x++) {
      for (int y = 0; y < PlateChunk.HEIGHT; y++) {
        if (grid[x][y] != 0) {
          grid[x][y] = Integer.MAX_VALUE;
        } else {
View Full Code Here

TOP

Related Classes of Hexel.math.Vector2i

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.