Fills the interior of a region of the display enclosed by an arbitrary 2D or 3Dpolygon.
If only one parameter is specified, x must be an array of either two or three vectors: (2,*) or (3,*). In this special case, x(0,*) is taken as the x values, x(1,*) is taken as the y values, and x(2,*) is taken as the z values.
y
z
Channel | Fill_Pattern | Normal | Spacing |
Clip | Linestyle | Pattern | Symsize |
Color | Line_Fill | PClip | T3d |
Data | Noclip | Psym | Thick |
Device | Orientation |
Image_Coordinates
To warp an image over a polygon, pass the image into POLYFILL with the Pattern keyword, and specify a (2, n) array containing the image space coordinates that correspond to each of the n vertices with the Image_Coordinates keyword.
When present and nonzero, specifies that bilinear interpolation is used instead of the nearest-neighbor method of sampling.
When present and nonzero, produces improved transparency by Maximum Intensity Projection. Rather than setting an arbitrary threshold value, a pixel is set in the Z-buffer, regardless of its depth, if its intensity is greater than the current pixel in the buffer.
Threshold
Pixels less than the Threshold value are not drawn, producing a transparent effect.
POLYFILL uses various filling methods:
Line Fill Method
Patterned Fill Method
a = INTARR(10, 10)
FOR i = 0, 9 DO a(i, i) = !D.N_Colors - 1 a = a + ROTATE(a, 1) POLYFILL, [225, 375, 375, 225], $ [275, 275, 425, 425], /Device, Pattern = a
b = INTARR(10, 10)
b(*, 2) = !D.N_Colors - 1 b(*, 7) = !D.N_Colors - 1 POLYFILL, [40, 180, 110], [50, 50, 200], $ /Device, Pattern = b
c = INTARR(10, 10)
c(2, *) = !D.N_Colors - 1 c(7, *) = !D.N_Colors - 1 POLYFILL, [420, 560, 560, 490, 420], $ [50, 50, 130, 200, 130], /Device, $ Pattern = c
Figure 2-85 Pattern-filled polygons.
Figure 2-86 Pattern-filled polygons.
The SURFACE procedure is used to establish a three-dimensional transformation matrix that determines the view. The T3d keyword is used with POLYFILL so that the transformation matrix established by SURFACE is used.
PRO cubes, numcubes
COMMON com1, size, colr1, colr2, colr3 size = 1.0D/numcubes
LOADCT, 3
SURFACE, FLTARR(2, 2), /Nodata, XStyle = 4, $ YStyle = 4, ZStyle = 4, XRange = [0, 1], $ YRange = [-1, 0], ZRange = [0, 1], /Save
.
colr1 = FIX(!D.N_Colors/2.0) colr2 = (FIX((!D.N_Colors - colr1)/2.0) + $ colr1) MOD !D.N_Colors colr3 = (FIX((!D.N_Colors - colr2)/2.0) + $ colr1) MOD !D.N_Colors
z = 0 FOR i = FIX(numcubes), 1, -1 DO BEGIN
x = (FIX(numcubes) - i) * size
y = -size
z = z + size
FOR j = 1, i - 1 DO BEGIN
draw_cube, x, y, z
y = y - size
ENDFOR
x = (i - 1) * size + x
FOR j = 1, i DO BEGIN
DRAW_CUBE, x, y, z
x = x - size
ENDFOR
ENDFOR END PRO draw_cube, x, y, z
COMMON com1, size, colr1, colr2, colr3 left_face, x, y, z, colr1 right_face, x, y, z, colr2 top_face, x, y, z, colr3 END PRO left_face, x, y, z, colr COMMON com1, size POLYFILL, [x, x, x, x], [y, y, y + size, $ y + size], [z, z - size, z - size, z], $ /T3d, Color = colr
END PRO right_face, x, y, z, colr COMMON com1, size POLYFILL, [x, x + size, x + size, x], $ [y, y, y, y], [z, z, z - size, z - size], $ /T3d, Color = colr
END PRO top_face, x, y, z, colr COMMON com1, size POLYFILL, [x, x + size, x + size, x], $ [y, y, y + size, y + size], [z, z, z, z], $ /T3d, Color = colr
END
cubes.pro
in your directory, it can be compiled with the following command:
.RUN cubes
cubes, 8
Figure 2-87 Example of three-dimensional polygon filling.
Figure 2-88 Example of three-dimensional polygon filling.