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 (optional) A vector parameter providing the y-coordinates of the points to be connected.
z (optional) If present, a vector parameter providing the z-coordinates of the points to be connected. If z is not present, x and y are used to draw lines in two dimensions. z has no effect if the keyword T3d is not specified and the system variable !P.T3d = 0.
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.
Threshold Pixels less than the Threshold value are not drawn, producing a transparent effect.
POLYFILL uses various filling methods:
Line Fill Method Filling using parallel lines is device independent and works on all devices that can draw lines. Cross-hatching may be obtained with multiple fillings of differing orientations. The spacing, linestyle, orientation, and thickness of the filling lines may be specified using the corresponding keywords. The Line_Fill keyword selects this filling style, but is not required if either the Orientation or Spacing keywords are present.
Patterned Fill Method The method of patterned filling and the usage of various fill patterns is hardware dependent. The fill pattern array may be directly specified with the Pattern keyword for some output devices. If this keyword is omitted, the polygon is filled with the hardware-dependent pattern index specified by the Fill_Pattern keyword.
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.