|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.globalse.arena.sword.algorithm.Generator
Abstract base class for fractal generators. It provides some common functionality (getRandomValue, crop). Fractal generators must implement the generate() and the getMinMax() method.
Method Summary | |
protected double[][] |
crop(double[][] map)
Removes the last line and the last row of map. |
abstract double[][] |
generate(int x,
int y,
int logOfSize,
long seed,
double roughness)
Generates one tile of size (2^logSize)x(2^logSize). |
abstract double[] |
getMinMax()
Returns the range in which "most" height values and vegetation values are. |
protected double |
getRandomValue(double x,
double y,
double s,
double m,
long seed)
Returns a gaussian "random" value with standard deviation s and mean value mean value m. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public abstract double[][] generate(int x, int y, int logOfSize, long seed, double roughness)
x
- the x-coordinate of the tiley
- the y-coordinate of the tilelogSize
- the resulting size is 2^logSize + 1.roughness
- a value in [0,1] that determines how
rough the landscape will bepublic abstract double[] getMinMax()
protected double getRandomValue(double x, double y, double s, double m, long seed)
x
- the x coordinatey
- the y coordinates
- the standard deviationm
- the mean valueprotected double[][] crop(double[][] map)
map.length = map[i].length f.a. 0 <= i < map.length
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |