POLY_SPHERE Procedure

Generates the vertex list and polygon list that represent a sphere.

Usage

POLY_SPHERE, radius, px, py, vertex_list, polygon_list 

Input Parameters

radius — If radius is a scalar value, then all the polygons are generated at this radius.

If radius is a 2D (m, n) array, then the radius of each polygon is generated at the corresponding radius. The radius array is scaled to the dimensions (px, py) before use.

You can use the array returned by the GRID_SPHERE function as radius values.

px — A scalar value specifying the number of polygons around the equator.

py — A scalar value specifying the number of polygons around the meridian.

Output Parameters

vertex_list — A (3, n) array of polygon vertices.

polygon_list — The list of vertices for each polygon.

For more information, see the PV‑WAVE User Guide.

Keywords

Degrees — If Degrees is present and nonzero, then the values for XMin, XMax, YMin, and YMax are in degrees instead of radians.

XMax — The longitude of the right edge of the portion of the polygon mesh you want to use (where on the sphere the polygon mesh is to be extracted). Should be in the range –p to +p radians (–180 to +180 degrees). The value is assumed to be in radians unless the Degrees keyword is set.

If XMax is omitted, a longitude of p is mapped to the right edge of the polygon mesh for the entire sphere (when viewed from outside the sphere).

XMin — The longitude of the left edge of the portion of the polygon mesh you want to use (where on the sphere the polygon mesh is to be extracted). Should be in the range –p to +p radians (–180 to +180 degrees). The value is assumed to be in radians unless the Degrees keyword is set.

If XMin is omitted, a longitude of –p is mapped to the left edge of the polygon mesh for the entire sphere (when viewed from outside the sphere).

YMax — The latitude of the top edge of the polygon mesh. Should be in the range –p/2 to +p/2 radians (–90 to +90 degrees). The value is assumed to be in radians unless the Degrees keyword is set.

If YMax is omitted, a latitude of p/2 is mapped to the top edge of the polygon mesh for the entire sphere (when viewed from outside the sphere).

YMin — The latitude of the bottom edge of the portion of the polygon mesh you want to use (where on the sphere the polygon mesh is to be extracted). Should be in the range –p/2 to +p/2 radians (–90 to +90 degrees). The value is assumed to be in radians unless the Degrees keyword is set.

If YMin is omitted, a latitude of –p/2 is mapped to the bottom edge of the polygon mesh for the entire sphere (when viewed from outside sphere).

Discussion

The vertex_list and polygon_list generated by POLY_SPHERE are suitable for use with the POLYSHADE and POLY_PLOT rendering procedures.

To generate the polygons for a portion of a sphere, rather than an entire sphere, use the XMin, XMax, YMin, and YMax keywords. For example, to work with the central portion of the country from a map of the United States, you might use:

XMin=-110, XMax=-100, YMin=35, YMax=45

Example

This example displays an image warped onto a sphere.

PRO sphere_demo1
   xval = 512
   yval = 512
   img = BYTARR(xval, yval)
   OPENR, 1, !Data_Dir + 'mandril.img'
   READU, 1, img
   CLOSE, 1
   ; Read in the image and shrink it to a 128-by-128 array.
   xval = 128
   yval = 128
   img = REBIN(img, xval, yval)
   ; Define the sphere as a list of polygons.
   POLY_SPHERE, 1.0, xval, yval, vertex_list, polygon_list
   ; Set up the viewing window and load the color table.
   WINDOW, 0, Colors=128
   LOADCT, 4
   CENTER_VIEW, Ax=(-75.0), Az=(-90.0), Zoom=0.9
   ; Display the shaded surface representation of the data warped
   ; onto the sphere.
   TVSCL, POLYSHADE(vertex_list, polygon_list, /T3d, Shade=img)
   ; Display the original image in the corner of the window.
   TVSCL, img
END

For other examples, see the grid_demo5, sphere_demo2, and sphere_demo3 demonstration programs in:

<wavedir>/demo/arl
<wavedir>\demo\arl

Where <wavedir> is the main PV-WAVE directory.

See Also

GRID_SPHERE, POLYSHADE, POLY_SURF