Class WorldMapGenerator.HyperellipticalMap

java.lang.Object
squidpony.squidgrid.mapping.WorldMapGenerator
squidpony.squidgrid.mapping.WorldMapGenerator.HyperellipticalMap
All Implemented Interfaces:
Serializable
Enclosing class:
WorldMapGenerator

public static class WorldMapGenerator.HyperellipticalMap
extends WorldMapGenerator
A concrete implementation of WorldMapGenerator that projects the world map onto a shape that resembles a mix part-way between an ellipse and a rectangle. This is an equal-area projection, like EllipticalMap, so effects that fill areas on a map like PoliticalMapper will fill (almost) equally on any part of the map. This has less distortion around all the edges than the other maps here, especially when comparing the North and South poles with RoundSideMap. This uses the Tobler hyperelliptical projection. Example map
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • HyperellipticalMap

      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Always makes a 200x100 map. Uses FastNoise as its noise generator, with 1.0 as the octave multiplier affecting detail. If you were using HyperellipticalMap(long, int, int, Noise3D, double), then this would be the same as passing the parameters 0x1337BABE1337D00DL, 200, 100, DEFAULT_NOISE, 1.0. Example map, showing special shape
    • HyperellipticalMap

      public HyperellipticalMap​(int mapWidth, int mapHeight)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. 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 call WorldMapGenerator.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 later
      mapHeight - the height of the map(s) to generate; cannot be changed later
    • HyperellipticalMap

      public HyperellipticalMap​(long initialSeed, int mapWidth, int mapHeight)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Takes an initial seed and the width/height of the map. The initialSeed parameter may or may not be used, since you can specify the seed to use when you call WorldMapGenerator.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 generate
      mapWidth - the width of the map(s) to generate; cannot be changed later
      mapHeight - the height of the map(s) to generate; cannot be changed later
    • HyperellipticalMap

      public HyperellipticalMap​(long initialSeed, int mapWidth, int mapHeight, double octaveMultiplier)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Takes an initial seed and the width/height of the map. The initialSeed parameter may or may not be used, since you can specify the seed to use when you call WorldMapGenerator.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 generate
      mapWidth - the width of the map(s) to generate; cannot be changed later
      mapHeight - the height of the map(s) to generate; cannot be changed later
      octaveMultiplier - used to adjust the level of detail, with 0.5 at the bare-minimum detail and 1.0 normal
    • HyperellipticalMap

      public HyperellipticalMap​(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Takes an initial seed and the width/height of the map. The initialSeed parameter may or may not be used, since you can specify the seed to use when you call WorldMapGenerator.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. The suggested Noise3D implementation to use is FastNoise.instance.
      Parameters:
      initialSeed - the seed for the GWTRNG this uses; this may also be set per-call to generate
      mapWidth - the width of the map(s) to generate; cannot be changed later
      mapHeight - the height of the map(s) to generate; cannot be changed later
      noiseGenerator - an instance of a noise generator capable of 3D noise, usually FastNoise
    • HyperellipticalMap

      public HyperellipticalMap​(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator, double octaveMultiplier)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Takes an initial seed, the width/height of the map, and parameters for noise generation (a Noise.Noise3D implementation, where FastNoise.instance is suggested, 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). The initialSeed parameter may or may not be used, since you can specify the seed to use when you call WorldMapGenerator.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 for noiseGenerator, 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 static FastNoise.instance because it has no changing state between runs of the program). The octaveMultiplier 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 generate
      mapWidth - the width of the map(s) to generate; cannot be changed later
      mapHeight - the height of the map(s) to generate; cannot be changed later
      noiseGenerator - an instance of a noise generator capable of 3D noise, usually FastNoise
      octaveMultiplier - used to adjust the level of detail, with 0.5 at the bare-minimum detail and 1.0 normal
    • HyperellipticalMap

      public HyperellipticalMap​(long initialSeed, int mapWidth, int mapHeight, Noise.Noise3D noiseGenerator, double octaveMultiplier, double alpha, double kappa)
      Constructs a concrete WorldMapGenerator for a map that can be used to display a projection of a globe onto an ellipse without distortion of the sizes of features but with significant distortion of shape. Takes an initial seed, the width/height of the map, and parameters for noise generation (a Noise.Noise3D implementation, where FastNoise.instance is suggested, 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). The initialSeed parameter may or may not be used, since you can specify the seed to use when you call WorldMapGenerator.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 for noiseGenerator, 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 static FastNoise.instance because it has no changing state between runs of the program). The octaveMultiplier 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 generate
      mapWidth - the width of the map(s) to generate; cannot be changed later
      mapHeight - the height of the map(s) to generate; cannot be changed later
      noiseGenerator - an instance of a noise generator capable of 3D noise, usually FastNoise
      octaveMultiplier - used to adjust the level of detail, with 0.5 at the bare-minimum detail and 1.0 normal
      alpha - one of the Tobler parameters; 0.0625 is the default and this can range from 0.0 to 1.0 at least
      kappa - one of the Tobler parameters; 2.5 is the default but 2.0-5.0 range values are also often used
    • HyperellipticalMap

      Copies the HyperellipticalMap other to construct a new one that is exactly the same. References will only be shared to Noise classes.
      Parameters:
      other - a HyperellipticalMap to copy
  • Method Details

    • wrapX

      public int wrapX​(int x, int y)
      Overrides:
      wrapX in class WorldMapGenerator
    • wrapY

      public int wrapY​(int x, int y)
      Overrides:
      wrapY in class WorldMapGenerator
    • project

      public Coord project​(double latitude, double longitude)
      Given a latitude and longitude in radians (the conventional way of describing points on a globe), this gets the (x,y) Coord on the map projection this generator uses that corresponds to the given lat-lon coordinates. If this generator does not represent a globe (if it is toroidal, for instance) or if there is no "good way" to calculate the projection for a given lat-lon coordinate, this returns null. This implementation never returns null. If this is a supported operation and the parameters are valid, this returns a Coord with x between 0 and WorldMapGenerator.width, and y between 0 and WorldMapGenerator.height, both exclusive. Automatically wraps the Coord's values using wrapX(int, int) and wrapY(int, int).
      Overrides:
      project in class WorldMapGenerator
      Parameters:
      latitude - the latitude, from Math.PI * -0.5 to Math.PI * 0.5
      longitude - the longitude, from 0.0 to Math.PI * 2.0
      Returns:
      the point at the given latitude and longitude, as a Coord with x between 0 and WorldMapGenerator.width and y between 0 and WorldMapGenerator.height, or null if unsupported
    • regenerate

      protected void regenerate​(int startX, int startY, int usedWidth, int usedHeight, double landMod, double heatMod, int stateA, int stateB)
      Specified by:
      regenerate in class WorldMapGenerator