/* stereo.aml /* macro to make a synthetic stereopair /* from a DEM and corresponding HSV grids /* Produces a .gra file with two perspective views of the /* same scene with geometry similar to that of vertical /* aerial photographs with 100% overlap. /* YOU DON'T HAVE TO USE HSV GRIDS--SEE NOTE AT END OF THIS FILE /* /* Ralph Haugerud, U.S. Geological Survey /* rhaugerud@usgs.gov /* April 1998 /* Revised October 1998--improved perspective geometry, faster /* processing, added notes on bitmaps. /* To be run from ARC. /* /* inputs are /* ZGrid DEM /* /* HGrid, SGrid, VGrid coextensive HSV grids /* /* center map coordinates of center of /* of view. /* width width, in map units, of view /* /* NOTE THAT VIEW must lie entirely within extent of DEM /* /* output rootname of output .gra file /*********EDIT NEXT 7 LINES TO SUIT**************** &set ZGrid = tz &set HGrid = tzh &set SGrid = tzs &set VGrid = tzv &set center = 559900, 5291200 &set width = 5000 &set output = stereo1 /************************************************** &set xcenter = [extract 1 %center%] &set ycenter = [extract 2 %center%] &set xmin = [calc %xcenter% - %width% / 2] &set xmax = [calc %xcenter% + %width% / 2] &set ymin = [calc %ycenter% - %width% / 2] &set ymax = [calc %ycenter% + %width% / 2] &set window = %xmin% %ymin% %xmax% %ymax% &set dist = [calc 1.5 * %width%] /* determines distance from surface to camera &set inc = 89 /* look angle (down from horizon) of camera /* USE SCREENVIEW OPTION TO GET YOUR IMAGE WORKING /* then comment out two lines below /*&call ScreenView /*&return &call LeftImage &call RightImage arcplot display 1040 %output%.gra pagesize 20 10 plot %output%l.gra 1.5 1.5 plot %output%r.gra 11 1.5 textset font.txt textfont Palacio textquality kern textsize 10 pt textjustification CC move 5.5 1 text 'left image' move 15 1 text 'right image' quit &return /************************ &routine ScreenView &set ytarget = %ycenter% &set xtarget = [calc %xcenter% + %width% / 2] &set viewfield = 45 45 45 0 display 9999 3 ARCPLOT pagesize 8 8 &set azi = 270 &call AnImage &pause QUIT &return &routine LeftImage &set ytarget = %ycenter% &set xtarget = [calc %xcenter% - %width% / 2] arcplot display 1040 tempplot.gra &set azi = 270 pagesize 8 8 &call AnImage quit rotateplot tempplot %Output%l.gra 270 &set null = [delete tempplot.gra -file] &return &routine RightImage &set ytarget = %ycenter% &set xtarget = [calc %xcenter% + %width% / 2] arcplot display 1040 tempplot.gra &set azi = 90 pagesize 8 8 &call AnImage quit rotateplot tempplot %Output%r.gra 90 &set null = [delete tempplot.gra -file] &return &routine AnImage surface lattice %ZGrid% surfacetarget %xtarget% %ytarget% surfaceextent %window% surfaceobserver relative %azi% %inc% %dist% surfaceprojection PERSPECTIVE surfaceviewfield AUTO scenesky -10 10 white white scenesize 2000 /* may be set smaller for faster processing, less detail surfacescene gridcomposite hsv %HGrid% %SGrid% %VGrid% /**PUT ADDITIONAL PLOTTING COMMANDS HERE******* /**precede each vector plot command with SURFACEDRAPE &return /* You don't have to use HSV grids for the draped image. /* For example, to drape a standard USGS DRG: /* 1st, uncompress the DRG to a grid /* ARC: imagegrid drgcolormap /* 2nd, change the SURFACESCENE command 11 lines above /* (line 126 of this file) to /* surfacescene gridpaint # # # drgcolormap /* AND IT'S PRETTY FAST! /* /* Also, some rules of thumb: /* For near-photographic results, use at least a 50 DPI DEM-- /* e.g., for a 40,000-meter wide image on an 8" = 20 cm page, /* 400 cells/40,000m = 1 cell/100 meters or, for ease of processing, /* a 90m resample of a standard 30m DEM. /* For width = 5,000 meters, a 10m DEM is appropriate. /* If all you have are 30m DEMs, widths less than 10 km may not /* be advisable. /* /* Image data should be at least as detailed as the DEM they are /* draped over.