terrainHeight
Description
returns the terrain heights of the specified xy-positions for the terrain
data for a heights
= terrainHeight(scene
,x
,y
)uavScenario
object.
specifies additional options using name-value arguments. Enclose each
heights
= terrainHeight(___,Name,Value
)Name
in quotes.
Examples
Add Terrain and Buildings to UAV Scenario
This example shows how to add terrain and custom building mesh to a UAV scenario.
Add Terrain Surface
Add terrain surface based on terrain elevation data from the n39_w106_3arc_v2.dt1
DTED file.
addCustomTerrain("CustomTerrain","n39_w106_3arc_v2.dt1"); scenario = uavScenario("ReferenceLocation", [39.5 -105.5 0]); addMesh(scenario,"terrain", {"CustomTerrain", [-200 200], [-200 200]}, [0.6 0.6 0.6]); show3D(scenario);
Add Buildings
Add a couple custom building meshes using vertices and polygon meshes into the scenario. Use the terrainHeight
function to get ground height for each build base.
buildingCenters = [-50, -50; 100 100]; buildingHeights = [30 100]; buildingBoundary = [-25 -25; -25 50; 50 50; 50 -25]; for idx = 1:size(buildingCenters,1) buildingVertices = buildingBoundary+buildingCenters(idx,:); buildingBase = min(terrainHeight(scenario,buildingVertices(:,1),buildingVertices(:,2))); addMesh(scenario,"polygon", {buildingVertices, buildingBase+[0 buildingHeights(idx)]}, [0.3922 0.8314 0.0745]); end show3D(scenario); view([0 15])
Remove Custom Terrain
Remove the custom terrain that was imported.
removeCustomTerrain("CustomTerrain")
Input Arguments
scene
— UAV scenario
uavScenario
object
UAV scenario, specified as a uavScenario
object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: h = terrainHeight(scene,x,y,"UseLatLon",true)
uses latitude
and longitude for the x
and y
inputs.
UseLatLon
— Enable latitude and longitude coordinates
false
(default) | true
Enable latitude and longitude coordinates, specified as true
or
false
.
When specified as
true
, the x and y coordinates are interpreted as longitude and latitude, respectively.When specified as
false
, the x and y coordinates are interpreted as Cartesian coordinates.
ReferenceFrame
— Reference frame of coordinates
"ENU"
(default) | name of defined inertial frame
Reference frame of coordinates, specified as an inertial frame name defined in the
InertialFrames
property of the uavScenario
object scene
. You can add new inertial frames to the scenario
using the addInertialFrame
object function.
Output Arguments
Version History
Introduced in R2021a
See Also
uavScenario
| addMesh
| addCustomTerrain
| removeCustomTerrain
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)