Package Hexel.math

Examples of Hexel.math.Vector2i


    return grid;
  }

  private static Vector2i select(Random random, int[][] grid, int dist) {
    Vector2i p = new Vector2i();
    int n = 0;
    for (int x = 0; x < PlateChunk.WIDTH; x++) {
      for (int y = 0; y < PlateChunk.HEIGHT; y++) {
        int gdist = grid[x][y];
        if (gdist >= dist) {
View Full Code Here


    super(new HexBlockHeightMapGenerator(cleanup));
  }

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

    HexBlockHeightMap hbhm = new HexBlockHeightMap();

    int cx = cpos.x * Chunk.WIDTH;
    int cy = cpos.y * Chunk.HEIGHT;

    Vector2i tmp = new Vector2i();

    int[][] hmap = hbhm.heights;

    Vector2i hex = new Vector2i();
    Vector2i tri = new Vector2i();

    for (int y = 0; y < 16; y++) {
      for (int x = 0; x < 32; x++) {
        HexGeometry.tringleToHexel(cx + x, cy + y, hex);
        HexGeometry.hexelToTringle(hex.x, hex.y, tri);
View Full Code Here

      if (SHMCFile.has(ppos)) {
        shmc = SHMCFile.load(ppos);
      } else {
        shmc = this.shmcg.gen(ppos.x, ppos.y);
      }
      this.inMemorySHMCs.put(new Vector2i(ppos), shmc);
    }
  }
View Full Code Here

  public FractalHexagonalHeightMap(int seed){
    heightMapGen = new FractalHeightMapGenerator(seed);
  }
 
  public int getHeight(int x, int y, Vector2i tmp) {
    Vector2i hex = new Vector2i();
    Vector2i tri = new Vector2i();
    HexGeometry.tringleToHexel(x, y, hex);
    HexGeometry.hexelToTringle(hex.x, hex.y, tri);
    return heightMapGen.getHeight(tri.x, tri.y, tmp);
  }
View Full Code Here

    try {
      HeightMap h = this.cache.getIfPresent(p);
      if (h != null)
        return h;
      else
        return this.cache.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

    return hm.map[bx][by];
  }

  private HeightMap genHeightMap(Vector2i p){
    HeightMap h = new HeightMap(HM_W, HM_H, p.x, p.y);
    Vector2i tmp0 = new Vector2i();
    Vector2i tmp1 = new Vector2i();
    for (int x = 0; x < HM_W; x++){
      for (int y = 0; y < HM_H; y++){
        h.map[x][y] = getHeightHelper(p.x*HM_W+x, p.y*HM_H+y, tmp0, tmp1);
      }
    }
View Full Code Here

    }
    return h;
  }
 
  private int getHeightHelper(int x, int y, Vector2i tmp0, Vector2i tmp1) {
    Vector2i hex = tmp0;
    Vector2i tri = tmp1;
    HexGeometry.tringleToHexel(x, y, hex);
    HexGeometry.hexelToTringle(hex.x, hex.y, tri);
    return heightMapGen.getHeight(tri.x, tri.y, tmp0);
  }
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

    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

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.