예제 #1
0
  private void genVector() {
    double direction = core.Main.getRandomDouble(0, 360),
        magnitude = core.Function.gaussianDistribution(0.1, 0, core.Main.getRandomDouble(0, 1)) / 8;

    double coord[] = core.Function.polarToCartesian(direction, magnitude);
    xx += coord[0];
    yy += coord[1];
  }
예제 #2
0
  /** @param p */
  public void addPoint(Point p) {
    Collection<Point> contained = getContainedSet();
    Terrain terrain = Main.getWorld().getTerrain();

    if (!terrain.isValidPoint(p)) {
      return;
    }

    if (containsPoint(p)) {
      return;
    }

    TerrainTile tile = terrain.getTerrainTile(p);

    tile.addLocationComponent(this);
    contained.add(p);
  }
예제 #3
0
  /** @param p */
  public void removePoint(Point p) {
    Collection<Point> contained = getContainedSet();

    if (!contained.contains(p)) {
      return;
    }

    Terrain terrain = Main.getWorld().getTerrain();

    if (!terrain.isValidPoint(p)) {
      return;
    }

    TerrainTile tile = terrain.getTerrainTile(p);

    tile.removeLocationComponent(this);
    contained.remove(p);
  }