Display a Rotating Globe

Because the Globe display can be viewed from any angle without the need to recompute a projection, you can easily animate it to produce a rotating globe. If the displayed data is simple enough, such animations can be redrawn at relatively fast rates. In this exercise, you progressively add or replace features on a Globe display and rotate it under the control of a MATLAB® program that resets the view to rotate the globe from west to east in five-degree increments.

Set up a Globe display with a graticule. The view is from above the North Pole.

figure
axesm('globe');
gridm('GLineStyle','-','Gcolor',[.7 .8 .9],'Grid','on')

Show the axes, but hide the edges of the figure's box, and view it in perspective rather than orthographically (the default perspective).

Spin the globe one revolution using the supporting function "spin.m". The globe spins rapidly.

set(gca,'Box','off','Projection','perspective')

spin

To make the globe opaque, create a sea-level data grid. The globe is a uniform dark copper color with the grid overlaid.

Pop up the grid so it appears to float 2.5% above the surface. Prevent the display from stretching to fit the window.

Spin the globe one revolution. The motion is slower, due to the need to rerender the 180-by-360 mesh.

base = zeros(180,360);
baseR = georefcells([-90 90],[0 360],size(base));
copperColor = [0.62 0.38 0.24];
hs = geoshow(base,baseR,'FaceColor',copperColor);

setm(gca,'Galtitude',0.025);
axis vis3d

spin

Get ready to replace the uniform sphere with topographic relief by deleting the copper mesh.

Load the topographic data. Scale the elevations to have an exaggeration of 50 (in units of Earth radii) and plot the surface.

Show the Earth in space. Blacken the figure background, turn off the three axes, and spin again.

clmo(hs)

load topo
topo = topo / (earthRadius('km')* 20);
hs = meshm(topo,topolegend,size(topo),topo);
demcmap(topo)

set(gcf,'color','black');
axis off;
spin

The final view shows the Himalayas rising on the Eastern limb of the planet and the Andes on the Western limb.

You can apply lighting as well, which shifts as the planet rotates. Try the following settings, or experiment with others.

camlight right
lighting Gouraud;
material ([.7, .9, .8])

Here is the illuminated version of the final preceding view.

See Also

| |