Geoscience Reference
In-Depth Information
We also need to reduce the size of the array by a factor of 10 because most
VRML clients limit the number of vertices in a VRML i le. You can run an
experiment with a larger number of vertices and see whether it works with
your VRML sot ware.
LON = LON(1:10:end,1:10:end);
LAT = LAT(1:10:end,1:10:end);
SRTM = SRTM(1:10:end,1:10:end);
We also eliminate the edges of the data set, as these may cause problems
when writing the VRML i les.
LON = LON(2:end-1,2:end-1);
LAT = LAT(2:end-1,2:end-1);
SRTM = SRTM(2:end-1,2:end-1);
3D graphics can be generated from the elevation data using the function
trimesh
following Delaunay triangulation of the data set using
delaunay
.
tri = delaunay(LON,LAT);
trimesh(tri,LON,LAT,SRTM)
axis([35.5 37.5 -1.5 0.5 -500 4500]), axis off
Next, we determine the size of the array
SRTM
and reshape the 119-by-119
array
SRTM
to a
n
-by-1 array, where
n=xdim*ydim=14161
.
[xdim ydim] = size(SRTM);
SRTM = SRTM(:);
We then determine the range of the
z
-values and dei ne the spacing in
x
and
y
directions.
zrange = range(SRTM);
xspace = 10;
yspace = 10;
We again use the colormap
demcmap
to display the SRTM data set.
cmap = demcmap(SRTM,256);
Alternatively, we can use any other colormap, even one that we have created
ourselves, to display the digital terrain model. We then normalize the
elevation data to the
[1,length(cmap)]
range.
cmap = cmap(round((SRTM-min(SRTM)) ...
.*(size(cmap,1)-1)./zrange)+1,:);
h e Simulink 3D Animation User's Guide (MathWorks 2014b) contains a
great introduction in its chapter
Interact with Virtual Reality Worlds
, which