terrains

Standard terrains.

Module Contents

Functions

flat() → revolve2.modular_robot_simulation.Terrain)

Create a flat plane terrain.

crater(→ revolve2.modular_robot_simulation.Terrain)

Create a crater-like terrain with rugged floor using a heightmap.

rugged_heightmap(→ numpy.typing.NDArray[numpy.float_])

Create a rugged terrain heightmap.

bowl_heightmap(→ numpy.typing.NDArray[numpy.float_])

Create a terrain heightmap in the shape of a bowl.

flat(size: revolve2.simulation.scene.vector2.Vector2 = Vector2([20.0, 20.0])) revolve2.modular_robot_simulation.Terrain

Create a flat plane terrain.

Parameters:

size – Size of the plane.

Returns:

The created terrain.

crater(size: tuple[float, float], ruggedness: float, curviness: float, granularity_multiplier: float = 1.0) revolve2.modular_robot_simulation.Terrain

Create a crater-like terrain with rugged floor using a heightmap.

It will look like:

|            |
 \_        .'
   '.,^_..'

A combination of the rugged and bowl heightmaps.

Parameters:
  • size – Size of the crater.

  • ruggedness – How coarse the ground is.

  • curviness – Height of the edges of the crater.

  • granularity_multiplier – Multiplier for how many edges are used in the heightmap.

Returns:

The created terrain.

rugged_heightmap(size: tuple[float, float], num_edges: tuple[int, int], density: float = 1.0) numpy.typing.NDArray[numpy.float_]

Create a rugged terrain heightmap.

It will look like:

..^.__,^._.-.

Be aware: the maximum height of the heightmap is not actually 1. It is around [-1,1] but not exactly.

Parameters:
  • size – Size of the heightmap.

  • num_edges – How many edges to use for the heightmap.

  • density – How coarse the ruggedness is.

Returns:

The created heightmap as a 2 dimensional array.

bowl_heightmap(num_edges: tuple[int, int]) numpy.typing.NDArray[numpy.float_]

Create a terrain heightmap in the shape of a bowl.

It will look like:

|         |
 \       /
  '.___.'

The height of the edges of the bowl is 1.0 and the center is 0.0.

Parameters:

num_edges – How many edges to use for the heightmap.

Returns:

The created heightmap as a 2 dimensional array.