Reference Guide > P Routines > POLY_DEV Function
  

POLY_DEV Function
Returns a list of 3D points converted from normal coordinates to device coordinates.
Usage
result = POLY_DEV(points[,winx, winy])
Input Parameters
points — A (3, n) array of points (or vertices) to transform.
winx, winy — (optional) The maximum x and y dimension, respectively, in device coordinates. If these parameters are omitted, the values of !D.X_Size and !D.Y_Size are used.
Returned Value
result — The list of 3D points that has been converted from normal coordinates to device coordinates. The list is in long integer format.
Keywords
None.
Example
The program in this example displays a perspective view of a surface from a viewpoint within the data.
PRO poly_dev_ex1
   ; Specify the window and image size.
   winx = 700
   winy = 500
   imgx = 477
   imgy = 512
   ; Read in the elevation image data and Landsat image data.
   elev_dat = BYTARR(imgx, imgy)
   OPENR, 1, !Data_Dir + 'bldr_elev.dat'
   READU, 1, elev_dat
   CLOSE, 1
   landsat = BYTARR(imgx, imgy)
   OPENR, 1, !Data_Dir + 'bldr_img7.dat'
   READU, 1, landsat
   CLOSE, 1
   imgx = 120
   imgy = 125
   ; Shrink the elevation data to a 120-by-125 array.
   elev_dat = CONGRID(FLOAT(elev_dat), imgx, imgy, /Interp)
   ; Shrink the Landsat image to a 120-by-125 array and
   ; scale the image into the range of 0 - 127.
   landsat = BYTSCL(CONGRID(FLOAT(landsat), $
       imgx, imgy, /Interp), Top=127)
   ; Define the Z compression factor.
   zscale = 0.08
   ; Define the view parameters and compress the elevation data.
   viewpoint = [105.0, 70.0, (5.0 * zscale)]
   viewvector = [-10.0, -2.5, -0.75]
   perspective = 0.06
   izoom = 11.0
   viewup = [0.0, 1.0]
   viewcenter = [0.5, 0.5]
   xr = [0, (imgx - 1)]
   yr = [0, (imgy - 1)]
   zr = [MIN(elev_dat), MAX(elev_dat)]
   elev_dat = elev_dat * zscale
   ; Set up a 3D view based on eye-point and view vector.
   SET_VIEW3D, viewpoint, viewvector, perspective, izoom, $
      viewup, viewcenter, winx, winy, xr, yr, zr
   PRINT, 'Building polygons ...'
   ; Generate the polygons representing the surface.
   POLY_SURF, elev_dat, vertex_list, polygon_list, pg_num
   vertex_list = vertex_list
   PRINT, 'Normalizing coordinates ...'
   ; Convert polygon vertices from data to normal coordinates.
   vertex_list = POLY_NORM(vertex_list)
   PRINT, 'Transforming coordinates ...'
   ; Transform the new coordinates.
   vertex_list = POLY_TRANS(vertex_list, !P.T)
   PRINT, 'Changing to device coordinates ...'
   ; Convert the normal coordinates to device coordinates.
   vertex_list = POLY_DEV(vertex_list, winx, winy)
   ; Set up a new window for plotting.
   WINDOW, XSize=winx, YSize=winy, XPos=10, YPos=50, Colors=128
   PRINT, 'Plotting ...'
   ; Create an array containing one color for each polygon.
   landsat = POLY_C_CONV(polygon_list, landsat)
   POLY_PLOT, vertex_list, polygon_list, $
      pg_num, winx, winy, WoColorConvert(BYTSCL(landsat)), -1, -1
END
For other examples of POLY_DEV,  POLY_PLOT,  POLY_SURF, and  POLY_TRANS, see the sphere_demo2, sphere_demo3, and vol_demo4 demonstration programs in:
(UNIX) <wavedir>/demo/arl
(WIN) <wavedir>\demo\arl
Where <wavedir> is the main PV-WAVE directory.
See Also
POLY_NORM, POLY_TRANS
For more information, see the PV‑WAVE User’s Guide.

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