CENTER_VIEW Procedure
Sets system viewing parameters to display data in the center of the current window (a convenient way to set up a 3D view).
Usage
CENTER_VIEW
Parameters
None.
Keywords
AxThe angle, in degrees, at which to rotate the data around the x-axis. (Default: –60.0)
AyThe angle, in degrees, at which to rotate the data around the y-axis. (Default: 0.0)
AzThe angle, in degrees, at which to rotate the data around the z-axis. (Default: 30.0)
PerspThe perspective projection distance. If Persp is 0.0 (the default), then parallel projection is set.
WinxThe x size of the plot window in device coordinates. (Default: 640)
WinyThe y size of the plot window in device coordinates. (Default: 512)
Xr, Yr, Zr—Two-element vectors. Xr(0), Yr(0), and Zr(0) contain the minimum x, y, and z values, respectively, in the data to be plotted. Xr(1), Yr(1), and Zr(1) contain the maximum values for this data. The default is [–1.0, 1.0] for each of Xr, Yr, and Zr.
ZoomMagnification factor. The default is [0.5, 0.5, 0.5]. If Zoom contains one element, then the view is zoomed equally in the x, y, and z dimensions. If Zoom contains three elements, then the view is scaled by Zoom(0) in the x direction, Zoom(1) in the y direction, and Zoom(2) in the z direction.
Discussion
CENTER_VIEW sets the system 3D viewing transformation and conversion factors from data coordinates to normal coordinates so that data is displayed in the center of the current window. The correct aspect ratio of the data is preserved even if the plot window is not square.
 
note
The data is rotated Az degrees about the z-axis first, Ay degrees about the y-axis second, and Ax degrees about the x-axis last.
This procedure sets the system variables !P.T, !P.T3D, !X.S, !Y.S, and !Z.S, overriding any values you may have previously set. These system variables are described in Chapter 22: System Variables.
Example
This program shows 4D gridding of dense data and cut-away view of a block of volume data.
PRO center_view_ex1
   ; Generate random data to be used for shading.
   points = RANDOMU(s, 4, 1000)
   ; Grid the generated data.
   ival = FAST_GRID4(points, 32, 32, 32)
   ival = BYTSCL(ival)
   ; Pad the data with zeroes.
   block = BYTARR(30, 30, 30)
   block(*, *, *) = 255
   block = VOL_PAD(block, 1)
   ; Cut away portion of block array by setting elements to zero.
   block(0:16, 0:16, 16:31) = 0
   ; Set up the viewing window and load the color table. (The
   ; indices for the 32-by-32-by-32 volume we are viewing go 
   ; from 0 to 31.)
   WINDOW, 0, Colors=128
   LOADCT, 3
   CENTER_VIEW, Xr=[0.0, 31.0], Yr=[0.0, 31.0], $
      Zr=[0.0, 31.0], Ax=(-60.0), Az=45.0, Zoom=0.6
   ; Change the direction of the light source for shading.
   SET_SHADING, Light=[-1.0, 1.0, 0.2]
   ; Compute the 3D contour surface.
   SHADE_VOLUME, block, 1, vertex_list, polygon_list, $
      Shades=ival, /Low
   ; Render the cut-away block with light source shading.
   img1 = POLYSHADE(vertex_list, polygon_list, /T3d)
   ; Render the cut-away block shaded by the gridded data.
   img2 = POLYSHADE(vertex_list, polygon_list, Shades=ival, $
      /T3d)
   ; Display resulting composite image of the light source-shaded
   ; block and data-shaded image of the block.
   TVSCL, (FIX(img1) + FIX(img2))
END
For other examples, see the following demonstration programs: grid_demo4, grid_demo5, sphere_demo1, sphere_demo2, sphere_demo3, vol_demo2, vol_demo3, and vol_demo4 in these directories:
(UNIX) <wavedir>/demo/arl
(WIN) <wavedir>\demo\arl
Where <wavedir> is the main PV-WAVE directory.
See Also