Curves

The curve classes let you implement free-form curves, arcs, and path geometry that contain discontinuity (breaks or kinks in the smoothness of the curve) and that can be joined to form long, continuous curves. TGCurve3D can represent the geometry of all other 2-D and 3-D geometry classes.

Curves are defined by NonUniform Rational BSplines (NURBs). Non-uniform means that the parameterization of the curve can be changed to allow kinks, gaps, and smooth joins. Rational means that rational polynomials are used to allow exact representations of circles, ellipses, and other conic sections. BSpline stands for Basis spline, which is a spline curve very similar to the Bézier curve, but provides more local control and continuity to give you better curve fitting and modeling. See Chapter 4 for a discussion of discontinuity, curves, control points, and curve continuity

TCurve3D Concatenate GetOrder NearestParametric
DragPosition GetPoint RaiseOrder
DragTangent GetPoints Refine
Evaluate GetSectionOfCurve RefineUniform
GetControlPolyline InsertKnot RefineToBeziers
GetKnot IsBezier RefineToPinned
GetKnots IsConsistent ReverseDirection
GetMinParameter IsEmpty SetOrder
GetMaxParameter IsPinned SetPoint
GetNextDiscontinuity MakeCompatible SetPoints
GetNumberOfKnots MakeDiscontinuity SetKnots
GetNumberOfPoints MoveKnot SetKnotScheme
TGCurve3D ArcLength ApproximateParameterFromArcLength ApproximateArcLengthReparameterizationCurve
ApproximateLowerOrder

TGCurve3D descends from TBaseCurve. TBaseCurve is a template class for TGCurve and TGCurve3D. TBaseCurve contains functionality common to TGCurve and TGCurve3D. The conic curve classes descend from TGCurve and TGCurve3D. The conic curve classes are geometries that you can use to create TGCurve and TGCurve3D geometries in a variety of arcs. See Chapter 4 for details on the conic curve classes.

The code example below shows how you can create a 3-D curve from any 2-D curve geometry. See Chapter 4 for a number of examples using 2-D curves. The 2-D and 3-D curve functions are the same except that with a 3-D curve you have a third point, the z coordinate. Figure 153 shows the 3-D curve created from a 2-D polyline in the code fragment that follows.


      TGPolyline polyline2D;
      polyline2D.Append( TGPoint( 70, 40 ) );
      polyline2D.Append( TGPoint( 50, 80 ) );
      polyline2D.Append( TGPoint( 10, 90 ) );
      polyline2D.Append( TGPoint( 45, 110 ) );
      polyline2D.Append( TGPoint( 25, 155 ) );
      polyline2D.Append( TGPoint( 70, 130 ) );
      polyline2D.Append( TGPoint( 115, 155 ) );
      polyline2D.Append( TGPoint( 95, 110 ) );
      polyline2D.Append( TGPoint( 130, 90 ) );
      polyline2D.Append( TGPoint( 90, 80 ) );
      
      TGCurve curve2D( polyline2D );
      TGCurve3D curve3D( curve2D );
      
      TFrameBundle3D frameBundle( TRGBColor( 0, 0 , 0 ), 2.0 );
      TCurve3D curveGraphic3D( curve3D );
      curveGraphic3D.AdoptBundle( new TGrafBundle3D( frameBundle ) );
      
      curveGraphic3D.Draw( thePort );

[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