SHADE_SURF_IRR Procedure

Standard Library routine that creates a shaded-surface representation of a semiregularly gridded surface, with shading from either a light source model or from a specified array of intensities.

Usage

SHADE_SURF_IRR, z, x, y

Input Parameters

z—A two-dimensional array containing the values that make up the surface. If x and y are supplied, the surface is plotted as a function of the X,Y locations specified by their contents. Otherwise, the surface is generated as a function of the array index of each element of z.

x—A two-dimensional array specifying the x-coordinates for the contour surface. Each element of x specifies the x-coordinate of the corresponding point in z (xij specifies the x-coordinate for zij).

y—A two-dimensional array specifying the y-coordinates for each elevation. Each element of y specifies the y-coordinate of the corresponding point in z (yij specifies the y-coordinate for zij).

Keywords

Image—The name of a variable into which the image containing the shaded surface is stored. If this keyword is omitted, the image is displayed but not saved.

Max_Img_Size—For devices with scalable pixels (e.g., postscript), this keyword sets the largest allowed image size created internally to render the shaded surface. Larger values will result in a better quality image but at a cost of greater memory use and larger file size. The mimimum value is 100 (100x100), which will generally result in a poor-quality image. (Default: 400)

Shades—An array expression, of the same dimensions as z, containing the color index at each point. The shading of each pixel is interpolated from the surrounding Shades values. For most displays, this parameter should be scaled into the range of bytes. If this keyword is omitted, light source shading is used.

Other keywords let you control many aspects of the plot’s appearance. These keywords are listed in the following table. For a description of each keyword, see Graphics and Plotting Keywords.

Ax

Noclip

[XYZ]Margin

Az

Nodata

[XYZ]Minor

Background

Noerase

[XYZ]Range

Charsize

Normal

[XYZ]Style

Clip

Position

[XYZ]Tickname

Color

Save

[XYZ]Ticks

Data

T3d

[XYZ]Tickv

Device

Ticklen

[XYZ]Title

Font

[XYZ]Charsize

 

Discussion

The input data for SHADE_SURF_IRR must be able to be represented as an array of quadrilaterals. This procedure should be used when the (x, y, z) arrays are too irregular to be drawn by the SHADE_SURF procedure, but are still semiregular.

SHADE_SURF_IRR is similar to the SURFACE procedure. Given a semiregular grid of elevations, it produces a shaded surface representation of the data with hidden surfaces removed.

If the graphics output device has scalable pixels (e.g., PostScript), then the output image is scaled so that its largest dimension is less than or equal to 400. Use the Max_Img_Size keyword to increase this size.

When outputting to PostScript devices, the default for the Background keyword is white (index 255), rather than !P.Background.

Use the SET_SHADING procedure to control the direction of the light source and other shading parameters.

Note:

The NoErase keyword is ignored on devices that do not support TVRD()—for example, PostScript.

If the T3d keyword is set, the 3D to 2D transformation matrix contained in !P.T must project the z-axis to a line parallel to the device y-axis, or errors will occur.

Example

This example uses SHADE_SURF_IRR to display a shaded surface over an irregular grid. The function defining the surface is:

where:

The results are shown in Shaded Surface over Irregular Grid.

; Compute x- and y-components of a 200x100 regular grid.
x = (LINDGEN(200, 100) MOD 200) / 10.0 - 10.0
y = (LINDGEN(200, 100) / 200) / 10.0 - 5.0
; Build an irregular grid by perturbing the regular grid 
; by a random factor.
x = x + (RANDOMN(seed, 200, 100) - 2.0) / 16.0
y = y + (RANDOMN(seed, 200, 100) - 2.0) / 16.0
; Compute a two-dimensional array of elevations.
z = x * SIN(y) + y * COS(x)
; Display the shaded surface. The Ax keyword is used to
; specify the angle of rotation about the x-axis.
SHADE_SURF_IRR, z, x, y, Ax=70

 

Shaded Surface over Irregular Grid

See Also

SET_SHADING,  SHADE_SURF,  SURFACE