Package squidpony.squidgrid.mapping
Class WorldMapGenerator.RotatingSpaceMap
java.lang.Object
squidpony.squidgrid.mapping.WorldMapGenerator
squidpony.squidgrid.mapping.WorldMapGenerator.RotatingSpaceMap
- All Implemented Interfaces:
Serializable
- Enclosing class:
- WorldMapGenerator
public static class WorldMapGenerator.RotatingSpaceMap extends WorldMapGenerator
A concrete implementation of
Example view of a planet rotating. Another example.
WorldMapGenerator
that imitates an infinite-distance perspective view of a
world, showing only one hemisphere, that should be as wide as it is tall (its outline is a circle). It should
look as a world would when viewed from space, and implements rotation differently to allow the planet to be
rotated without recalculating all the data, though it cannot zoom. Note that calling
setCenterLongitude(double)
does a lot more work than in other classes, but less than fully calling
WorldMapGenerator.generate()
in those classes, since it doesn't remake the map data at a slightly different rotation and
instead keeps a single map in use the whole time, using sections of it. This uses an
Orthographic projection with
the latitude always at the equator; the internal map is stored as a WorldMapGenerator.SphereMap
, which uses a
cylindrical equal-area
projection, specifically the Smyth equal-surface projection.
Example view of a planet rotating. Another example.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class squidpony.squidgrid.mapping.WorldMapGenerator
WorldMapGenerator.BiomeMapper, WorldMapGenerator.DetailedBiomeMapper, WorldMapGenerator.EllipticalHammerMap, WorldMapGenerator.EllipticalMap, WorldMapGenerator.HyperellipticalMap, WorldMapGenerator.LocalMap, WorldMapGenerator.LocalMimicMap, WorldMapGenerator.MimicMap, WorldMapGenerator.RotatingSpaceMap, WorldMapGenerator.RoundSideMap, WorldMapGenerator.SimpleBiomeMapper, WorldMapGenerator.SpaceViewMap, WorldMapGenerator.SphereMap, WorldMapGenerator.TilingMap
-
Field Summary
Fields Modifier and Type Field Description protected int[]
edges
protected double
maxHeat0
protected double
maxHeat1
protected double
maxWet0
protected double
minHeat0
protected double
minHeat1
protected double
minWet0
WorldMapGenerator.SphereMap
storedMap
double[][]
xPositions
double[][]
yPositions
double[][]
zPositions
Fields inherited from class squidpony.squidgrid.mapping.WorldMapGenerator
cacheA, cacheB, centerLongitude, coastalWaterLower, coastalWaterUpper, deepWaterLower, deepWaterUpper, DEFAULT_NOISE, forestLower, forestUpper, grassLower, grassUpper, heatData, heatModifier, height, heightCodeData, heightData, landData, landModifier, maxHeat, maxHeight, maxHeightActual, maxWet, mediumWaterLower, mediumWaterUpper, minHeat, minHeight, minHeightActual, minWet, moistureData, rng, rockLower, rockUpper, sandLower, sandUpper, seedA, seedB, shallowWaterLower, shallowWaterUpper, snowLower, snowUpper, startCacheX, startCacheY, startX, startY, usedHeight, usedWidth, width, zoom, zoomStartX, zoomStartY
-
Constructor Summary
Constructors Constructor Description RotatingSpaceMap()
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(int mapWidth, int mapHeight)
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight)
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight, double octaveMultiplier)
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator)
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator, double octaveMultiplier)
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time.RotatingSpaceMap(WorldMapGenerator.RotatingSpaceMap other)
Copies the RotatingSpaceMapother
to construct a new one that is exactly the same. -
Method Summary
Modifier and Type Method Description protected void
regenerate(int startX, int startY, int usedWidth, int usedHeight, double landMod, double heatMod, int stateA, int stateB)
void
setCenterLongitude(double centerLongitude)
Sets the center longitude line to a longitude measured in radians, from 0 to 2 * PI.int
wrapX(int x, int y)
int
wrapY(int x, int y)
Methods inherited from class squidpony.squidgrid.mapping.WorldMapGenerator
codeHeight, decodeX, decodeY, generate, generate, generate, getCenterLongitude, project, removeExcess, zoomIn, zoomIn, zoomOut, zoomOut
-
Field Details
-
Constructor Details
-
RotatingSpaceMap
public RotatingSpaceMap()Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Always makes a 100x100 map. Uses FastNoise as its noise generator, with 1.0 as the octave multiplier affecting detail. If you were usingRotatingSpaceMap(long, int, int, Noise3D, double)
, then this would be the same as passing the parameters0x1337BABE1337D00DL, 100, 100, DEFAULT_NOISE, 1.0
. -
RotatingSpaceMap
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Takes only the width/height of the map. The initial seed is set to the same large long every time, and it's likely that you would set the seed when you callWorldMapGenerator.generate(long)
. The width and height of the map cannot be changed after the fact, but you can zoom in. Uses FastNoise as its noise generator, with 1.0 as the octave multiplier affecting detail.- Parameters:
mapWidth
- the width of the map(s) to generate; cannot be changed latermapHeight
- the height of the map(s) to generate; cannot be changed later
-
RotatingSpaceMap
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Takes an initial seed and the width/height of the map. TheinitialSeed
parameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long)
. The width and height of the map cannot be changed after the fact, but you can zoom in. Uses FastNoise as its noise generator, with 1.0 as the octave multiplier affecting detail.- Parameters:
initialSeed
- the seed for the GWTRNG this uses; this may also be set per-call to generatemapWidth
- the width of the map(s) to generate; cannot be changed latermapHeight
- the height of the map(s) to generate; cannot be changed later
-
RotatingSpaceMap
Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Takes an initial seed and the width/height of the map. TheinitialSeed
parameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long)
. The width and height of the map cannot be changed after the fact, but you can zoom in. Uses FastNoise as its noise generator, with the given octave multiplier affecting detail.- Parameters:
initialSeed
- the seed for the GWTRNG this uses; this may also be set per-call to generatemapWidth
- the width of the map(s) to generate; cannot be changed latermapHeight
- the height of the map(s) to generate; cannot be changed lateroctaveMultiplier
- used to adjust the level of detail, with 0.5 at the bare-minimum detail and 1.0 normal
-
RotatingSpaceMap
public RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator)Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Takes an initial seed and the width/height of the map. TheinitialSeed
parameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long)
. The width and height of the map cannot be changed after the fact, but you can zoom in. Uses the given noise generator, with 1.0 as the octave multiplier affecting detail.- Parameters:
initialSeed
- the seed for the GWTRNG this uses; this may also be set per-call to generatemapWidth
- the width of the map(s) to generate; cannot be changed latermapHeight
- the height of the map(s) to generate; cannot be changed laternoiseGenerator
- an instance of a noise generator capable of 3D noise, usuallyFastNoise
-
RotatingSpaceMap
public RotatingSpaceMap(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator, double octaveMultiplier)Constructs a concrete WorldMapGenerator for a map that can be used to view a spherical world from space, showing only one hemisphere at a time. Takes an initial seed, the width/height of the map, and parameters for noise generation (aNoise.Noise3D
implementation, which is usuallyFastNoise.instance
, and a multiplier on how many octaves of noise to use, with 1.0 being normal (high) detail and higher multipliers producing even more detailed noise when zoomed-in). TheinitialSeed
parameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long)
. The width and height of the map cannot be changed after the fact, but you can zoom in. FastNoise will be the fastest 3D generator to use fornoiseGenerator
, and the seed it's constructed with doesn't matter because this will change the seed several times at different scales of noise (it's fine to use the staticFastNoise.instance
because it has no changing state between runs of the program). TheoctaveMultiplier
parameter should probably be no lower than 0.5, but can be arbitrarily high if you're willing to spend much more time on generating detail only noticeable at very high zoom; normally 1.0 is fine and may even be too high for maps that don't require zooming.- Parameters:
initialSeed
- the seed for the GWTRNG this uses; this may also be set per-call to generatemapWidth
- the width of the map(s) to generate; cannot be changed latermapHeight
- the height of the map(s) to generate; cannot be changed laternoiseGenerator
- an instance of a noise generator capable of 3D noise, usuallyFastNoise
octaveMultiplier
- used to adjust the level of detail, with 0.5 at the bare-minimum detail and 1.0 normal
-
RotatingSpaceMap
Copies the RotatingSpaceMapother
to construct a new one that is exactly the same. References will only be shared to Noise classes.- Parameters:
other
- a RotatingSpaceMap to copy
-
-
Method Details
-
wrapX
- Overrides:
wrapX
in classWorldMapGenerator
-
wrapY
- Overrides:
wrapY
in classWorldMapGenerator
-
setCenterLongitude
Description copied from class:WorldMapGenerator
Sets the center longitude line to a longitude measured in radians, from 0 to 2 * PI. Positive arguments will be corrected with modulo, but negative ones may not always act as expected, and are strongly discouraged.- Overrides:
setCenterLongitude
in classWorldMapGenerator
- Parameters:
centerLongitude
- the longitude to center the map projection on, from 0 to 2 * PI (can be any non-negative double).
-
regenerate
protected void regenerate(int startX, int startY, int usedWidth, int usedHeight, double landMod, double heatMod, int stateA, int stateB)- Specified by:
regenerate
in classWorldMapGenerator
-