Terrain¶
ssqp::model::terrain::Terrain describes the ground a model's contacts act against. See
Terrain in Concepts for how it's used. The reference below is generated directly from the
headers' own doc comments.
Class ssqp::model::terrain::Terrain¶
ClassList > ssqp > model > terrain > Terrain
Inherited by the following classes: ssqp::model::terrain::predefined::FlatTerrain, ssqp::model::terrain::predefined::HeightmapTerrain, ssqp::model::terrain::predefined::SlopeTerrain, ssqp::model::terrain::predefined::StepTerrain
Classes¶
| Type | Name |
|---|---|
| struct | TerrainPoint |
Public Functions¶
| Type | Name |
|---|---|
| virtual TerrainPoint | at (const double x, const double y) const = 0 |
| TerrainPoint | at (const Vec2 & p) const |
| virtual double | distance (const double x, const double y, const double z) const |
| double | distance (const Vec3 & p) const |
| virtual nlohmann::ordered_json | to_json () const |
Public Functions Documentation¶
function at [1/2]¶
function at [2/2]¶
function distance [1/2]¶
virtual double ssqp::model::terrain::Terrain::distance (
const double x,
const double y,
const double z
) const
function distance [2/2]¶
function to_json¶
The documentation for this class was generated from the following file /home/runner/work/ssqp/ssqp/include/model/terrain/Terrain.hpp
FlatTerrain¶
Class ssqp::model::terrain::predefined::FlatTerrain¶
ClassList > ssqp > model > terrain > predefined > FlatTerrain
Inherits the following classes: ssqp::model::terrain::Terrain
Public Functions¶
| Type | Name |
|---|---|
| FlatTerrain (const double base_height=0.0) |
|
| TerrainPoint | at (const double x, const double y) override const |
| nlohmann::ordered_json | to_json () override const |
Public Functions Documentation¶
function FlatTerrain¶
function at¶
TerrainPoint ssqp::model::terrain::predefined::FlatTerrain::at (
const double x,
const double y
) override const
function to_json¶
The documentation for this class was generated from the following file /home/runner/work/ssqp/ssqp/include/model/terrain/predefined/FlatTerrain.hpp
SlopeTerrain¶
Class ssqp::model::terrain::predefined::SlopeTerrain¶
ClassList > ssqp > model > terrain > predefined > SlopeTerrain
#include <SlopeTerrain.hpp>
Inherits the following classes: ssqp::model::terrain::Terrain
Public Functions¶
| Type | Name |
|---|---|
| SlopeTerrain (const double slope_x, const double slope_y=0.0, const double base_height=0.0) |
|
| TerrainPoint | at (const double x, const double y) override const |
| nlohmann::ordered_json | to_json () override const |
Detailed Description¶
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)
Public Functions Documentation¶
function SlopeTerrain¶
ssqp::model::terrain::predefined::SlopeTerrain::SlopeTerrain (
const double slope_x,
const double slope_y=0.0,
const double base_height=0.0
)
function at¶
TerrainPoint ssqp::model::terrain::predefined::SlopeTerrain::at (
const double x,
const double y
) override const
function to_json¶
The documentation for this class was generated from the following file /home/runner/work/ssqp/ssqp/include/model/terrain/predefined/SlopeTerrain.hpp
StepTerrain¶
Class ssqp::model::terrain::predefined::StepTerrain¶
ClassList > ssqp > model > terrain > predefined > StepTerrain
#include <StepTerrain.hpp>
Inherits the following classes: ssqp::model::terrain::Terrain
Public Functions¶
| Type | Name |
|---|---|
| StepTerrain (const double x_start, const double step_height, const double step_length=1.0, const uint num_steps=1, const double base_height=0.0) |
|
| TerrainPoint | at (const double x, const double y) override const |
| nlohmann::ordered_json | to_json () override const |
Detailed Description¶
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
Public Functions Documentation¶
function StepTerrain¶
ssqp::model::terrain::predefined::StepTerrain::StepTerrain (
const double x_start,
const double step_height,
const double step_length=1.0,
const uint num_steps=1,
const double base_height=0.0
)
function at¶
TerrainPoint ssqp::model::terrain::predefined::StepTerrain::at (
const double x,
const double y
) override const
function to_json¶
The documentation for this class was generated from the following file /home/runner/work/ssqp/ssqp/include/model/terrain/predefined/StepTerrain.hpp
HeightmapTerrain¶
Class ssqp::model::terrain::predefined::HeightmapTerrain¶
ClassList > ssqp > model > terrain > predefined > HeightmapTerrain
#include <HeightmapTerrain.hpp>
Inherits the following classes: ssqp::model::terrain::Terrain
Public Functions¶
| Type | Name |
|---|---|
| HeightmapTerrain (const MatX & heights, const double resolution, const double x0=0.0, const double y0=0.0) |
|
| TerrainPoint | at (const double x, const double y) override const |
| void | set_heights (const MatX & heights, const double x0=0.0, const double y0=0.0) |
| nlohmann::ordered_json | to_json () override const |
Detailed Description¶
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
Public Functions Documentation¶
function HeightmapTerrain¶
ssqp::model::terrain::predefined::HeightmapTerrain::HeightmapTerrain (
const MatX & heights,
const double resolution,
const double x0=0.0,
const double y0=0.0
)
function at¶
TerrainPoint ssqp::model::terrain::predefined::HeightmapTerrain::at (
const double x,
const double y
) override const
function set_heights¶
void ssqp::model::terrain::predefined::HeightmapTerrain::set_heights (
const MatX & heights,
const double x0=0.0,
const double y0=0.0
)
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
function to_json¶
nlohmann::ordered_json ssqp::model::terrain::predefined::HeightmapTerrain::to_json () override const
The documentation for this class was generated from the following file /home/runner/work/ssqp/ssqp/include/model/terrain/predefined/HeightmapTerrain.hpp
Custom terrain¶
Subclass Terrain and implement at (required), optionally overriding distance, to model non-flat ground
(stairs, slopes, heightmaps) for locomotion tasks. Pass an instance via Model::Structure::terrain.