virtual void MGraphic::RotateBy( const GDegrees angle, const TGPoint& centerOfRotation = TGPoint::kOrigin );
centerOfRotation: The default center of rotation is TGPoint::kOrigin (the upper-left corner of the view). The center of rotation determines the point around which the graphic is rotated. A center of rotation other than the center of the graphic can rotate the graphic beyond the visible area of the view.
Figure 24
Center of graphic
shape->RotateBy( 15, shape->GetGeometricBounds().GetCenter() );
shape->Draw( thePort );
Origin of view
shape->RotateBy( 15, TGPoint::kOrigin );
shape->Draw( thePort );
TGPoint( 0, 200 )
shape->RotateBy( 15, TGPoint( 0, 200 ) );
shape->Draw( thePort );
You might want to refer to a book on matrix multiplication, particularly a section on rotation matrices, to see how the new points are calculated for this example.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.