ssqpy.model.terrain¶
terrain ¶
Submodule containing the Terrain class, used to define the 3D terrain
that the system model acts in. By default, this is the predefined
FlatTerrain class.
TerrainPoint ¶
A point on the terrain surface: its height, surface frame and height derivatives.
from_height
staticmethod
¶
Builds a point from the height and its derivatives, using the frame convention required by contact constraints: normal = (-dhdx, -dhdy, 1) normalized, t1 = (1, 0, dhdx) normalized, t2 = normal x t1.
Terrain ¶
SlopeTerrain ¶
Bases: Terrain
Slope terrain
Height is \(h = h_0 + s_x x + s_y y\), where \(s_x\) and \(s_y\) are the slopes
along the x and y axes (rise over run)
StepTerrain ¶
Bases: Terrain
Piecewise flat terrain with a flight of steps along the x axis
Height is base_height for \(x < x_{start}\), then rises by step_height at
x_start and every step_length after that, for num_steps steps in total
The terrain stays at the top step height afterwards; with the default of a
single step, step_length has no effect
HeightmapTerrain ¶
Bases: Terrain
Smooth terrain interpolated from a uniform grid of heights
heights(i, j) is the height at \((x_0 + i r, y_0 + j r)\), where \(r\) is the
grid resolution
Heights are interpolated with a bicubic Catmull-Rom spline, which passes
through every grid height and has continuous height and slope
The height second derivatives are piecewise continuous
Outside the grid, the terrain extends flat from its closest edge value
set_heights ¶
Replaces the grid of heights and its origin, keeping the resolution. The grid may change size. Models using this terrain see the new heights from their next evaluation, so this must not be called while a solver is using such a model.