Rasterizing rotated ellipses

Rasterizing rotated ellipses

Post by CM Killpa » Thu, 08 Jan 1998 04:00:00



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

 
 
 

Rasterizing rotated ellipses

Post by Lasse Staff Jense » Thu, 08 Jan 1998 04:00:00



> 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.

 
 
 

Rasterizing rotated ellipses

Post by Ian Kemmi » Thu, 08 Jan 1998 04:00:00



Quote:

>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.

A rotated ellipse looks the same on the screen as a skewed ellipse (albeit of a
slightly different eccentricity).  If you can generate the tables for the
upright case, then you can just skew that to get the tables you want.

Unfortunately, I did this 13 years ago and probably threw the actual code out
several house-cleanings ago.  However, getting the eccentricity and skew right
is not *too* bad.  (For the eccentricity, look at where the ellipse crosses the  
x-axis; for the skew, look at where the points on the perimeter with maximum
and minimum y-values end up)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ian Kemmish                   18 Durham Close, Biggleswade, Beds SG18 8HZ, UK

Information on Jaws and 5D's other products availabe at http://www.five-d.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'The universe may be as great as they say,
but it wouldn't be missed if it didn't exist'  ... Piet Hein

 
 
 

1. tilted ellipse, rasterize code ?

Does anyone know where I might findcode to
create a rasterized tilted ellipse ?  I'm looking for
something along the lines of a Bresenham's line/cirle
algorithm. Ellipse algorithms are easy to find but I
can't seem to find one for a _tilted_ ellipse.
Help !
  Thanx,
    Chris

2. Educational Liscense

3. Locating focii/axes of a rasterized ellipse?

4. HPGL to Tek 4014 converter+display under OSF/1?

5. Rotated Ellipses

6. Virtus 3-D Website Builder anyone?

7. Scan converting ellipses rotated around the z-axis

8. Anti-aliasing shareware

9. Rotate an ellipse under the X-Windows

10. Rotated Ellipses

11. Scan converting rotated ellipses?

12. Drawing rotated ellipses

13. tangent to rotated ellipse