GPIEXY Call

CALL GPIEXY (x, y, fract-radii, angles <*>, center <*>, radius <*>, window ) ;

The GPIEXY subroutine is a graphical call that converts from polar to world coordinates.

The GPIEXY subroutine returns the following output arguments:

x

names a vector to contain the horizontal coordinates returned by GPIEXY.

y

names a vector to contain the vertical coordinates returned by GPIEXY.

The required input arguments to the GPIEXY subroutine are as follows:

fract-radii

is a vector of fractions of the radius of the reference circle.

angles

is the vector of angle coordinates in degrees.

The optional input arguments to the GPIEXY subroutine are as follows:

center

defines the reference circle.

radius

defines the reference circle.

window

is a numeric matrix or literal that specifies a window. This is given in world coordinates and has the form

 

{minimum-x minimum-y maximum-x maximum-y}

The GPIEXY subroutine computes the world coordinates of a sequence of points relative to a circle. The x and y arguments are vectors of new coordinates returned by the GPIEXY subroutine. Together, the vectors fract-radii and angles define the points in polar coordinates. Each pair from the fract-radii and angles vectors yields a corresponding pair in the x and y vectors. For example, suppose fract-radii has two elements, 0.5 and 0.33 and the corresponding two elements of angles are 90 and 30. The GPIEXY subroutine returns two elements in the x vector and two elements in the y vector. The first $(x,y)$ pair locates a point halfway from the center to the reference circle on the vertical line through the center, and the second $(x,y)$ pair locates a point one-third of the way on the line segment from the center to the reference circle, where the line segment slants 30 degrees from the horizontal. The reference circle can be defined by an earlier GPIE call or another GPIEXY call, or it can be defined by specifying center and radius.

Graphics devices can have diverse aspect ratios; thus, a circle can appear distorted when drawn on some devices. The PROC IML graphics subsystem adjusts computations to compensate for this distortion. Thus, for any given point, the transformation from polar coordinates to world coordinates might need an equivalent adjustment. The GPIEXY subroutine ensures that the same adjustment applied in the GPIE subroutine is applied to the conversion. An example that uses the GPIEXY call follows:

call gstart;
center = {50 50};
r = 30;
angle1 = {0 90 180 270};
angle2 = {90 180 270 360};
call gpie(center[1], center[2], r, angle1, angle2);
/* add labels to a pie with 4 slices of equal size */
angle = (angle1+angle2)/2;   /* middle of slice */
call gpiexy(x, y, 1.2, angle, center, r);

/* adjust for label size: */
x [1,] = x[1,] - 4;
x [2,] = x[2,] + 1;
x [4,] = x[4,] - 3;
call gscript(x, y, {"QTR1" "QTR2" "QTR3" "QTR4"});
call gshow;