Ellipse curve example

The curve shown in Figure 46 uses the TGCurve constructor that accepts an ellipse and two parameters that define an elliptical arc from which to create a curve.


The following code fragment creates a curve from an ellipse. The ellipse defines the dimensions of the curve. The elliptical arc is defined by the parameters 45 and 180 which are type GDegrees. In this code fragment, the elliptical arc moves from 45 degrees to 90 degrees. The elliptical arc always goes counterclockwise because sines and cosines are always counterclockwise. However, since the 2-D coordinate system has the y values pointing down, the arc goes clockwise to the person viewing the curve.

      TGEllipse ellipse( TGRect( 10, 10, 225, 40 ) );
      TGCurve ellipseCurve( ellipse, 45, 180 );
      TFrameBundle aBundle( TRGBColor( 0, 0, 0), 5.0 );
      thePort.Draw( ellipseCurve, 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