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]; }
/** @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); }
/** @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); }