newton.geometry.generate_terrain_grid#

newton.geometry.generate_terrain_grid(grid_size=(4, 4), block_size=(5.0, 5.0), terrain_types=None, terrain_params=None, seed=None)[source]#

Generate a grid of procedural terrain blocks.

This is the main public API function for generating terrain grids.

Parameters:
  • grid_size (tuple[int, int]) – (rows, cols) number of terrain blocks

  • block_size (tuple[float, float]) – (width, height) size of each terrain block in meters

  • terrain_types (list[str] | str | object | None) – List of terrain type names, single terrain type string, or callable function (any object with __call__). If None, uses all types. Available types: ‘flat’, ‘pyramid_stairs’, ‘random_grid’, ‘wave’, ‘box’, ‘gap’, ‘heightfield’

  • terrain_params (dict[str, dict[str, Any]] | None) – Dictionary mapping terrain types to their parameter dicts. For ‘heightfield’ type, params should include ‘heightfield’ (np.ndarray)

  • seed (int | None) – Random seed for reproducibility

Returns:

  • vertices: (N, 3) float32 array of vertex positions

  • indices: (M,) int32 array of triangle indices (flattened)

Return type:

tuple of (vertices, indices) where