Archived

This topic is now archived and is closed to further replies.

Lantz

4-connected midpoint ellipse algorithm

Recommended Posts

I have this assignment where I'm supposed to write some 2D primitive generation code and I'm kinda stuck. I need to make a 4-connected (ie step x or step y only) ellipse using the midpoint algorithm. Everything I've found on the net does this, but 8-connected instead, so that doesn't help. The decision function for this is:
f(x,y) = x^2*b^2 + y^2*a^2 - a^2*b^2
Which gives the distance to a perfect ellipse with radius a in the x direction and b in the y direction. Using this as it is works perfectly, gives me a nice ellipse. But how do I take this and go to the incremental integer decision parameter form or whatever its called? I've tried messing around with it but I can't get it right, and the explanation in my book is crappy. Could anyone describe how to find the different values, ie. how to update the decision parameter and find its initial value etc? Thanks, Lantz [edited by - Lantz on May 21, 2004 6:05:47 PM]

Share this post


Link to post
Share on other sites
Nope it means (according to my teacher) that one are only allowed to step in either x or y, no diagonal movement. Dont know if that makes sense.

Share this post


Link to post
Share on other sites
Sounds like you looking for info on the Bresenham ellipse drawing algorithm. Use those keywords and google should pop up some nice results. That said, the question is off topic (homework) and so I''m closing the thread.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.