Documentation
¶
Index ¶
- func CalcMean(nums []float64) float64
- func MinMax(hm []float64) (float64, float64)
- type GenFunc
- func GenCone(slope float64) GenFunc
- func GenCrater(center vectors.Vec2, diameter, lip, depth float64) GenFunc
- func GenFissure(p1, p2 vectors.Vec2, steps int, lip, drop, amplitude, width float64, ...) GenFunc
- func GenMountainRange(p1, p2 vectors.Vec2, steps int, radius, amplitude, maxHeight float64, ...) GenFunc
- func GenMountains(maxX, maxY float64, n int, r float64) GenFunc
- func GenNoise(seed int64, slope float64) GenFunc
- func GenSlope(direction vectors.Vec2) GenFunc
- func GenVolCone(slope float64) GenFunc
- type GetHeight
- type GetNeighbors
- type Modify
- type ModifyWithIndex
- type Terrain
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GenFunc ¶
func GenCone ¶
GenCone returns a generator function for a cone at the center of the heightmap. TODO: Allow the user to specify the center of the cone.
func GenCrater ¶
GenCrater modifies the height values in a circular region to create a crater with a lip.
func GenFissure ¶
func GenFissure(p1, p2 vectors.Vec2, steps int, lip, drop, amplitude, width float64, useNormalVecs bool) GenFunc
GenFissure returns a generator function that produces a fissure between two points on the heightmap, with the given increase in height at the lips and the drop in elevation at the base of the fissure.
NOTE: We use a biased random walk to generate the fissure path using the given points as the starting and ending points of the walk, and the given number of steps as the number of steps in the walk, as well as the amplitude of the walk and the width of the fissure.
UseNormalVecs determines whether we use the normal vector of the path to generate the path of the fissure, or if we use a random vector.
func GenMountainRange ¶
func GenMountainRange(p1, p2 vectors.Vec2, steps int, radius, amplitude, maxHeight float64, useNormalVecs bool) GenFunc
GenMountainRange returns a generator function that produces a mountain range between the two given points, with the given number of peaks (or steps), the given radius of the mountains, and the given amplitude of the variation in the mountain range and a maximum height of the mountains
NOTE: We use a biased random walk to generate the mountain range using the given points as the starting and ending points of the walk, and the given number of steps as the number of steps in the walk, as well as the amplitude of the walk and the radius of the mountains.
UseNormalVecs determines whether we use the normal vector of the path to generate the path of the mountain range, or if we use a random vector.
func GenMountains ¶
GenMountains returns a generator function that will return the height of a point on the heightmap given the point's coordinates, which will produce a number of mountains. TODO: The seed should be passed into the function as parameter.
'maxX', 'maxY' are the dimensions of the heightmap. 'n' is the number of mountains. 'r' is the radius of the mountains.
func GenNoise ¶
GenNoise returns a function that returns the noise/height value of a given point on the heightmap. Not sure what the slope parameter was supposed to do.
func GenSlope ¶
GenSlope returns a generator function that produces a slope in the direction of the given vector.
func GenVolCone ¶
GenVolCone returns a generator function for a volcanic cone at the center of the heightmap. TODO: Allow the user to specify the center of the cone.
type GetNeighbors ¶
GetNeighbors returns all neighbor indices of an index on the heightmap.
type Modify ¶
Modify is a function that modifies a value in a heightmap.
func ModNormalize ¶
ModNormalize normalizes the heightmap to the range [0, 1] given the min and max values (the range of heightmap values).
func ModPeaky ¶
func ModPeaky() Modify
ModPeaky returns the function applied to a point on a heightmap in order to exaggerate the peaks of the map.
func ModSeaLevel ¶
ModSeaLevel shifts the origin point to the sea level, resulting in all points below sea level being negative.
type ModifyWithIndex ¶
ModifyWithIndex is a function that modifies a value in a heightmap given its index and current value.
func ModRelax ¶
func ModRelax(n GetNeighbors, h GetHeight) ModifyWithIndex
ModRelax applies a relaxation algorithm to the heightmap.