gpi12.hlp (Table of Contents; Topic list)
GpiPolyFillet (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIPRIMITIVES
 
LONG GpiPolyFillet(hps, cptl, aptl)
HPS hps;         /* presentation-space handle                 */
LONG cptl;       /* number of points in array                 */
PPOINTL aptl;    /* address of array of structures for points */
 
The GpiPolyFillet function draws one or more fillets. The function draws the
fillets by using the points specified by the aptl parameter. The function
needs at least two points to draw a fillet. If exactly two points are
specified, the function draws the fillet from the current position to the
second point, using the first point as a control point. If more than two
points are given, the function uses each point (except the last) as a
control point, computing the end point of each fillet as needed. The
function draws each fillet by using the current line-color, line-mix,
line-width, and line-type attributes.
 
The GpiPolyFillet function moves the current position to the end point of
the last fillet.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
cptl       Specifies the number of points.
 
aptl       Points to an array of POINTL structures that contain the points.
 
Return Value
 
The return value is GPI_OK or GPI_HITS if the function is successful (it is
GPI_HITS if the detectable attribute is set for the presentation space and a
correlation hit occurs). The return value is GPI_ERROR if an error occurs.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_COORDINATE
     PMERR_INV_HPS
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_PS_BUSY
 
Comments
 
A fillet is a smooth curve whose path is controlled by three points: a start
point, an end point, and a control point.
 
When given two points, the GpiPolyFillet function draws a fillet by first
constructing two imaginary straight lines, one from the current position to
the control point (the first point) and another from the control point to
the end point (the second point). The function then draws the curve from the
current position to the end point. The curve is drawn so that the first
imaginary line is tangent to the curve at the current position and the
second imaginary line is tangent to the curve at the second point. Only the
curve is drawn, never the imaginary lines.
 
When given more than two points, the function constructs a series of
imaginary straight lines, then draws a series of curves. The function draws
the first curve from the current position to the midpoint of the second
imaginary line, the second curve from the midpoint of the second line to the
midpoint of the third, and so on until it draws the last curve from a
midpoint to the last point specified.
 
The maximum number of fillets allowed in the polyfillet depends on the
length of coordinates, but is at least 4000.
 
Example
 
This example uses the GpiPolyFillet function to draw a curve with a loop.
The four points are the four points of a rectangle. The curve is drawn from
the lower-left corner, through the midpoint of the top edge, and back to the
lower-right corner.
 
POINTL ptlStart = { 0, 0 };
POINTL aptl[3] = { 200, 100, 0, 100, 200, 0 };
 
GpiMove(hps, &ptlStart);        /* move to the lower-left corner */
GpiPolyFillet(hps, 3L, aptl};   /* draw the curve                */
 
See Also
 
GpiMove, GpiPolyFilletSharp, GpiPolyLine, GpiSetAttrs, GpiSetColor,
GpiSetCurrentPosition, GpiSetLineType, POINTL