Closed loop example

Loops derive from curves and represent a closed curve. For that reason, most of the loop constructors are the same as or very similar to the curve constructors described above. The main difference is that the loop geometry has the EOFill flag and overloaded constructors to accept an ellipse, polygon, rectangle, or glyph run. Figure 47 shows the loop created by the code fragment that follows.


The following code fragment creates a loop with the EOFill set to True and a pinned uniform knot vector (both by default because they are unspecified). Notice that this code is almost exactly like the quadratic curve from a TGRPointArray example. To keep the code fragment concise, the code that creates the attribute is not shown.

      static const TGRPoint loopPointArray[ 4 ] = {
                                  TGRPoint( 175, 125, 1 ), 
                                  TGRPoint( 195, 200, 1 ),
                                  TGRPoint( 245, 175, 1 ),
                                  TGRPoint( 220, 150, 1 ) 
                                                  };
      
      TGRPointArray aLoopArray( 4 );
      for( long n = 0; n < 4; n++ )
          aLoopArray.SetPoint( n, loopPointArray[ n ] );
      
      TGLoop aGeneralLoop( 4, aLoopArray, knots );
      TFillAndFrameBundle aBundle( TRGBColor( .75, .5, .5), TRGBColor( 0, 0, 0 ), 5.0 );
      thePort.Draw( aGeneralLoop, aBundle );

[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