Polylines are linear (order 2) curves and are parameterized as such. That is, a polyline with three points is parameterized from 0 to 2, where the line between the first point and the second point is 0 to 1, and the line between the second point and the third point is 1 to 2. See the heading "Curves, loops, and knot vectors" on page 79 for information on linear curves and curve order.
TPolyline | AddBefore | GetPoints | RemovePoint | |
Append | GetNumberOfPoints | ReverseDirection | ||
DragPosition | IsRectilinear | SetPoint | ||
GetPoint | NearestParametric | SetPoints |
The following code creates and draws the star polyline shown in the margin. With a polyline, the first point and the last point do not close.
TGPolyline aPolylineGeometry; aPolylineGeometry.Append( TGPoint( 70, 40 ) ); aPolylineGeometry.Append( TGPoint( 50, 80 ) ); aPolylineGeometry.Append( TGPoint( 10, 90 ) ); aPolylineGeometry.Append( TGPoint( 45, 110 ) ); aPolylineGeometry.Append( TGPoint( 25, 155 ) ); aPolylineGeometry.Append( TGPoint( 70, 130 ) ); aPolylineGeometry.Append( TGPoint( 115, 155 ) ); aPolylineGeometry.Append( TGPoint( 95, 110 ) ); aPolylineGeometry.Append( TGPoint( 130, 90 ) ); aPolylineGeometry.Append( TGPoint( 90, 80 ) ); TGrafBundle* aBundle = new TGrafBundle( TFrameBundle( TRGBColor( 0, 0, 0), 5.0 ) ); TPolyline aPolyline( aPolylineGeometry, aBundle ); aPolyline.Draw( thePort );