GpiPolyFillet
This function draws a curve starting at the current position and defined by the points supplied.
Syntax
GpiPolyFillet (hps, lCount, aptlPoints)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lCount (LONG) - input
- Number of points.
- Must not be negative. Zero is valid but causes no output.
- aptlPoints (PPOINTL) - input
- Array of points.
Returns
- lHits (LONG) - returns
- Correlation and error indicators.
- GPI_OK
- Successful
- GPI_HITS
- Correlate hits
- GPI_ERROR
- Error.
Errors
Possible returns from WinGetLastError
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
- PMERR_INV_COORDINATE (0x205B)
- An invalid coordinate value was specified.
- PMERR_INV_NESTED_FIGURES (0x20A8)
- Nested figures have been detected within a path definition.
Remarks
If two points are supplied, an imaginary straight line is drawn from the current position to the first point and a second straight line from the first point to the second. A curve is then constructed, starting at the current position and tangential to the first straight line. The curve is drawn such that it reaches the last point at a tangent to the second straight line. Example A shows the curve constructed, given current position A and the two points B and C.
If more than two points are supplied, a series of imaginary straight lines is constructed through them (as in the GpiPolyLine function). All of the straight lines except the first and last are then divided in two at their mid-points. A series of curved fillets is then drawn, each starting at the end point of the last, at one of the mid-points. Example B shows the curve constructed, given current position A and three points B, C, and D.
The current position is set to the last point.
Each individual fillet always lies within the area bounded by the start, end, and control points.
It is not an error for any of the points to be coincident.
The maximum number of fillets allowed in the polyfillet is more than 4 000.
Example Code
#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lCount; /* Number of points. */ PPOINTL aptlPoints; /* Array of points. */ LONG lHits; /* Correlation and error indicators. */ lHits = GpiPolyFillet(hps, lCount, aptlPoints);
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.
#define INCL_GPIPRIMITIVES /* GPI primitive functions */ #include <os2.h> HPS hps; /* presentation space handle */ POINTL ptlStart = { 0, 0 }; /* start point */ POINTL aptl[3] = { 200, 100, 0, 100, 200, 0 }; /* curve points */ GpiMove(hps, &ptlStart); /* move to the lower-left corner */ GpiPolyFillet(hps, 3L, aptl); /* draw the curve */
Graphic Elements and Orders
- Element Type
- OCODE_GCFLT
- Order: Fillet at Current Position
- As many of these orders are generated as is necessary to hold the specified fillets.