Drawing ellipses with rotated axes

Giganews Newsgroups
Subject:Drawing ellipses with rotated axes
Posted by: Enquiring Mind
Date:Wed, 29 Jul 2009

I need to draw ellipses with rotated axes, possibly filled. A simple approach would be to compute points along the circumference, then plot these as a polygon, but this seems rather inefficient. I am vaguely aware that the Windows API function SetWorldTransform used in conjunction with certain other API functions allows a rotation between world space and display space axes to be assigned to the plot device context. It would be rather nice if an encapsulation of the API functions were made available as met
hods of TCanvas. Specifically 2 methods are needed: SetRotatedAxes(CosTheta, SinTheta), to set rotated axes, and SetDefaultAxes, to restore axes to default axes.

I presume that if the SetWorldTransform API is called before TCanvas.Ellipse, the ellipse will be drawn relative to the rotated axes. Is that correct? In people's experience, does using this low-level approach produce much faster results than the polygon approach?

TIA.

EM

Replies