Package squidpony.squidgrid.mapping
Class HeightMapFactory
java.lang.Object
squidpony.squidgrid.mapping.HeightMapFactory
public class HeightMapFactory extends Object
Tools to create maps. Not commonly used outside of code that needs height maps.
- Author:
- Eben Howard - http://squidpony.com - howard@squidpony.com
- See Also:
WorldMapGenerator is a much-more-detailed kind of map generator.
-
Constructor Summary
Constructors Constructor Description HeightMapFactory()
-
Method Summary
Modifier and Type Method Description static double[][]
heightMap(int width, int height, double offset)
Returns a randomly generated map of doubles that smoothly change nearby.static float[][]
heightMapSeeded(int width, int height, int seed)
Returns a randomly generated map of floats.
-
Constructor Details
-
HeightMapFactory
public HeightMapFactory()
-
-
Method Details
-
heightMap
Returns a randomly generated map of doubles that smoothly change nearby. Commonly referred to as a Height Map. UsesFastNoise
to generate coherent heights. Theoffset
parameter is converted to an int seed viaNumberTools.doubleToMixedIntBits(double)
, so it can be any double, even an infinite one, and will still be treated as a valid seed.- Parameters:
width
- in cellsheight
- in cellsoffset
- a double that changes the sampling process; the range doesn't matter- Returns:
- the created map as a 2D double array
-
heightMapSeeded
Returns a randomly generated map of floats. Commonly referred to as a Height Map. UsesFastNoise
(producing FBM Simplex noise) to generate coherent heights. UnlikeheightMap(int, int, double)
, this doesn't drop off heights at the east and west edges of the map. As such, it may be more suitable for local maps than world maps, since it is unlikely to tile east-west.- Parameters:
width
- in cellsheight
- in cellsseed
- an int that significantly changes the generation process- Returns:
- the created map as a 2D float array
-