The CREATE_VIEW procedure sets the various system variables required to define a coordinate system and a 3D view. This procedure builds the system viewing matrix ( !P.T) in such a way that the correct aspect ratio of the data is maintained even if the display window is not square. CREATE_VIEW also sets the "Data" to "Normal" coordinate conversion factors (!X.S, !Y.S, and !Z.S) so that center of the unit cube will be located at the center of the display window.
CREATE_VIEW sets the following IDL system variables:
!P.T, !P.T3D, !P.Position, !P.Clip, !P.Region !X.S, !X.Style, !X.Range, !X.Margin !Y.S, !Y.Style, !Y.Range, !Y.Margin, !Z.S, !Z.Style, !Z.Range, !Z.Margin.
This routine is written in the IDL language. Its source code can be found in the file
create_view.pro
in the
lib
subdirectory of the IDL distribution.
A floating-point value specifying the perspective projection distance. A value of 0.0 indicates an isometric projection (NO perspective). The default is 0.0.
A long integer specifying the X size, in pixels, of the window that the view is being set up for. The default is 640.
A long integer specifying the Y size, in pixels, of the window that the view is being set up for. The default is 512.
Set up a view to display an iso-surface from volumetric data. First, create some data:
vol(3:36, 3:46, 3:26) = RANDOMU(S, 34, 44, 24)
FOR I = 0, 10 DO vol = SMOOTH(vol, 3)
SHADE_VOLUME, vol, 0.2, polygon_list, vertex_list, /LOW
Set up the view. Note that the subscripts into the Vol array range from 0 to 39 in X, 0 to 49 in Y, and 0 to 29 in Z. As such, the 3-D coordinates of the iso-surface (vertex_list) may have the same range. Set XMIN, YMIN, and ZMIN to zero (the default), and set XMAX=39, YMAX=49, and ZMAX=29.
WINDOW, XSIZE = 600, YSIZE = 400
CREATE_VIEW, XMAX = 39, YMAX = 49, ZMAX = 29, $
AX = (-60.0), AZ = (30.0), WINX = 600, WINY = 400, $
Display the iso-surface in the specified view.