Reference Guide > P Routines > POLY_C_CONV Function
  

POLY_C_CONV Function
Returns a list of colors for each polygon, given a polygon list and a list of colors for each vertex.
Usage
result = POLY_C_CONV(polygon_list, colors)
Input Parameters
polygon_list — An array containing a list of polygons. For more information, see the PV‑WAVE User’s Guide.
colors — A vertex-based color list.
Returned Value
result — An integer vector containing the list of colors, one color for each input polygon. (In other words, the result contains the same number of colors as the number of polygons in polygon_list.)
Keywords
None.
Discussion
POLY_C_CONV is useful for converting a vertex-based color list to a polygon-based list. For example, the SHADE_VOLUME procedure returns a list of polygon colors when the Shades keyword is used. This list has one color per vertex. The POLY_PLOT procedure, however, requires a color list with one color per polygon.
Example
This example program displays data warped onto an irregular sphere.
PRO sphere_demo2
   radii = RANDOMU(s, 60, 60)
   radii = SMOOTH((radii + 1.0), 2)
   ; Define the sphere as a list of polygons.
   POLY_SPHERE, radii, 60, 60, vertex_list, polygon_list
   ; Define the shading colors for the sphere.
   p_colors = BYTSCL(DIST(60), Top=127)
   ; Set up the viewing window and load the color table.
   WINDOW, 0, Colors=128, XPos=16, YPos=384
   LOADCT, 1
   CENTER_VIEW, Xr=[-2.0, 2.0], Yr=[-2.0, 2.0], $
      Zr=[-2.0, 2.0], Ax=(-75.0), Az=(-90.0), Zoom=0.99
   ; Construct a shaded surface representation of the data
   ; and display it using POLYSHADE.
   TVSCL, POLYSHADE(vertex_list, polygon_list, $
      /T3d, Shade=WoColorConvert(p_colors))
   ; Create a new window for a new plot.
   WINDOW, 1, Colors=128, XPos=256, YPos=64
   ; Count the number of polygons in the sphere.
   pg_num = POLY_COUNT(polygon_list)
   ; Transform polygon vertices from data coordinates to
   ; device coordinates.
   vertex_list = POLY_NORM(vertex_list)
   vertex_list = POLY_TRANS(vertex_list, !P.T)
   vertex_list = POLY_DEV(vertex_list, 640, 512)
   ; Convert colors from a vertex-based list to a
   ; polygon-based list.
   p_colors = POLY_C_CONV(polygon_list, p_colors(*))
   ; Plot the sphere using POLY_PLOT.
   POLY_PLOT, vertex_list, polygon_list, $
      pg_num, 640, 512, WoColorConvert(p_colors), 0, -1
END
For another POLY_C_CONV example, see the poly_demo1 demonstration program. This programs and others are found in:
(UNIX) <wavedir>/demo/arl
(WIN) <wavedir>\demo\arl
Where <wavedir> is the main PV-WAVE directory.
See Also
POLY_PLOT, POLYSHADE, SHADE_VOLUME

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.