Polylines

A polyline defines a set of points that are connected by straight lines. A polyline is not explicitly closed. If you want a closed polyline, use the polygon classes because closing a polyline can result in imperfect closure.

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 Chapter 4 for details.

TPolyline3D AddBefore GetNumberOfPoints RemovePoint
Append GetPoint ReverseDirection
DragPosition GetPoints SetPoint
Evaluate NearestParametric SetPoints

The following code fragment creates the 3-D polyline shown in Figure 155. This polyline looks like the curve polyline shown in Figure 153. However, this polyline has 3-D points with z coordinate values of 0 and is manipulated as a polyline geometry, and the curve polyline in Figure 153 is manipulated as a curve graphic.


      TGPolyline3D polyline3D;
      polyline3D.Append( TGPoint3D( 70, 40, 0) );
      polyline3D.Append( TGPoint3D( 50, 80, 0) );
      polyline3D.Append( TGPoint3D( 10, 90, 0) );
      polyline3D.Append( TGPoint3D( 45, 110, 0 ) );
      polyline3D.Append( TGPoint3D( 25, 155, 0 ) );
      polyline3D.Append( TGPoint3D( 70, 130, 0 ) );
      polyline3D.Append( TGPoint3D( 115, 155, 0 ) );
      polyline3D.Append( TGPoint3D( 95, 110, 0 ) );
      polyline3D.Append( TGPoint3D( 130, 90, 0 ) );
      polyline3D.Append( TGPoint3D( 90, 80, 0 ) );
      thePort.Draw( polyline3D );

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker