Tires
GenerateTerrain
generate a Terrain object from an expression
Calling Sequence
Parameters
Options
Description
Examples
GenerateTerrain(ex, var_range, grid, opts)
ex
-
algebraic; the height of the terrain
var_range
list; the ranges of the two independent variables
grid
[posint,posint]; the number of points on each axis
opts
(optional) equation(s) of the form option = value; specify options for the GenerateTerrain command
title = string
Specifies the title. The default is "Undefined".
up_direction = "x", "y", or "z"
Specifies which direction is up. The default is "z".
The GenerateTerrain method can be used to generate a terrain using an expression defining the dependent variable associated with the up direction. Depending on the axis chosen as the up direction, the independent variables in the terrain expression must be one of {x,y}, {y,z}, or {z,x}. Use of any other variable is forbidden in the terrain expression.
The ex parameter is an algebraic expression of the height of the terrain in terms of the chosen independent variables. The expression is discretized at the breakpoints defined by the var_range and grid arguments. Each of these arguments is a list with two elements. The order of the corresponding axis to each element depends on the axis assigned to up direction. For example, if y is the up direction, the first and second elements of both var_rang and grid will be associated with z and x, respectively.
The var_range parameter specifies the ranges of the two independent variables. It can either be a list of two ranges, with each range specifying the minimum and maximum values of one of the variables, or a list of two two-element sublists, with each sublist specifying the minimum and maximum values of one of the variables.
The grid parameter specifies the number of sample points used for each of the two independent axes.
with⁡Tires:
Defining the terrain expression.
ex≔0.1⁢tanh⁡x−5−tanh⁡x−30:
Generate a Terrain object using the defined expression. Select the z axis as the up direction. The order of the two independent variables is then [x,y]. Assign the range for the first one, x, to be from -10 to 100 and for the second one, y, to be from -10 to 10. Use 50 grid points for the x axis and 10 for the y axis. Set the title to "myTerrain".
terrain≔GenerateTerrain⁡ex,−10..100,−10..10,50,10,up_direction=z,title=myTerrain:
Plot the generated terrain.
terrain:-Plot⁡
See Also
Download Help Document