Skip to content

raisim::TerrainGenerator ​

class · #include <raisim/Terrain.hpp>

Generates fractal Perlin-noise height samples from TerrainProperties. The constructors fatal on invalid properties (see validateTerrainProperties()).

Constructors & destructor ​

TerrainGenerator ​

cpp
TerrainGenerator()

Uses default TerrainProperties.

cpp
TerrainGenerator(const TerrainProperties &terrain_property)

Parameters

ParameterDescription
terrain_property (in)terrain parameters; the noise is seeded with terrain_property.seed

Public member functions ​

setSeed ​

cpp
void setSeed(std::uint32_t seed)

Reseed the noise and clear the generated heights.

Parameters

ParameterDescription
seed (in)new seed

clear ​

cpp
void clear()

Clear the generated heights.

getTerrainProp ​

cpp
TerrainProperties &getTerrainProp()

Returns the properties, modifiable; changes take effect at the next generatePerlinFractalTerrain(). Change the seed with setSeed() so that the noise is reseeded.

getHeightMap ​

cpp
std::vector<double> &getHeightMap()

Returns the heights of the last generatePerlinFractalTerrain() call (empty after clear())

generatePerlinFractalTerrain ​

cpp
std::vector<double> &generatePerlinFractalTerrain()

Generate the heights. Fatal if the current properties are invalid.

Returns xSamples * ySamples heights (m), indexed by y * xSamples + x. The reference stays owned by the generator

RaiSim — physics for robotics and AI.