Reference Guide > S Routines > SURFR Procedure
  

SURFR Procedure
Standard Library procedure that duplicates the rotation, translation, and scaling of the SURFACE procedure.
Usage
SURFR
Parameters
None.
Keywords
Ax—Angle of rotation about the x-axis in degrees. (Default: 30 degrees)
Az—Angle of rotation about the z-axis in degrees. (Default: 30 degrees)
Discussion
SURFR should be used for axonometric projections only. The 4-by-4 matrix in the system variable !P.T receives the homogeneous transformation matrix generated by this procedure.
SURFR performs the following steps:
1. Translates unit cube so that the center (.5, .5, .5) is moved to the origin.
2. Rotates –90 degrees about the x-axis to make the +z-axis of the data the +y-axis of the display. The +y data axis extends from the front of the display to the back.
3. Rotates about the y-axis Az degrees. This rotates the result counterclockwise as seen from above the page.
4. Rotates about the x-axis Ax degrees, tilting the data towards the viewer.
5. Translates back to the origin and scales the data so that the data are still contained within the unit cube after the transformation. (This step uses the SCALE3D procedure.)
Example 1
; Load a color table.
TEK_COLOR 
data = HANNING(50, 50)
; Create the 3D spatial transformation. By default, the angle of 
; rotation is defined as 30 degrees around the x- and y-axes.
SURFR
; Create the contour plot in the 3D space.
CONTOUR, data, Nlevels=20, /Follow, /T3D, Charsize=1.5
; Now try it with different angles of rotation.
SURFR,Ax=45, Az=10
; Create the contour plot in the 3D space.
CONTOUR, data, Nlevels=20, /Follow, /T3D, Charsize=1.5
SURFACE, data, /Save, Color=3
CONTOUR, data, Nlevels=20, /Follow, /T3D, Charsize=1.5
 
note
For an informative display, the above example could be done using the SHADE_SURF or SURFACE procedures instead of SURFR, as shown below. (SURFR is not needed in this case because these two procedures themselves set up the 3D view area.)
Example 2
This example displays a cube as a shaded surface and rotates it.
xmin = 0 & xmax = 1
xmin = xmin - 1.5 & xmax = xmax+1.5
; Set up scaling for the 3D view.
!x.s = [-xmin,1.0] / (xmax - xmin)
!y.s = !x.s
!z.s = !x.s
; Create the array of vertices.
vert = FLTARR(3, 8)
FOR i=1L, 2   DO vert(0, i) = 1
FOR i=5L, 6   DO vert(0, i) = 1
FOR i=2L, 3   DO vert(1, i) = 1
FOR i=6L, 7   DO vert(1, i) = 1
FOR i=4L, 7   DO vert(2, i) = 1
; Create the connectivity array.
poly = FLTARR(30)
poly(0:4)   = [4, 0, 3, 2, 1]
poly(5:9)   = [4, 1, 2, 6, 5]
poly(10:14) = [4, 5, 6, 7, 4]
poly(15:19) = [4, 4, 7, 3, 0]
poly(20:24) = [4, 3, 7, 6, 2]
poly(25:29) = [4, 0, 1, 5, 4]
SURFR
img = POLYSHADE(vert, poly, /T3D, /Data)
; Display the cube with the default rotations.
TV, img
SURFR, Ax=50, Az=10
img = POLYSHADE(vert, poly, /T3D, /Data)
; Display the cube rotated 50 degrees around the x-axis and 10
; degrees around the z-axis.
TV, img
 
note
This example can be done more simply with the CENTER_VIEW procedure, which is available in the Advanced Rendering Library. This library is located:
<wavedir>/demo/arl
<wavedir>:[DEMO.ARL]
<wavedir>\demo\arl
Where <wavedir> is the main PV-WAVE directory. For more information, view the .pro file for this procedure.
See Also
SCALE3D,   SURFACE,   T3D
System Variables:  !P.T

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.