> I have a problem (don't we all?),
> I need to draw rotated ellipses on the screen. Or to be more exact I need
> to know what pixels rotated ellipses cover, hence I need to inspect every
> pixel of every scanline which the ellipse occupies.
> Currently I have a routine which rasterizes/scan-edges ellipses into a
> start&end table indexed by scanline. However I need to handle rotation as
> well. If I calculate my x,y as per usual and then rotate to give X,Y then
> a fractional Y will cause (and has done) problems when I index the
> scantable Y.
> Does anyone know of any algorithm to perform this correctly??
> Thanks in advance,
> Chris Killpack
Hi, Chris!
I have done this using general conics, i.e.
f(x, y) = ax^2 + bxy + cy^2 + dx + ey + f = 0
To calculate the coefficients for a given ellipse, you have to select two
point
on the curve and solve for the coefficients. In order to
generate the outline of the ellipse I'm using the midpoint forward
differencing
conic plotter described (brifly) in the bible; "Computer Graphic principles
and
practice". The basic idea is to divide the conic into eight octants according
to the gradiant (df/dx, df/dy) and then use the ordinary midpoint algorithm
to
decide between the two pixel choices for the given octant. Well read the
bible and try it.. It's a bit work, but you will not regret it... promise!
- Lasse S. Jensen
PS! If you get stucked mail me, and I send you a more detailed description.