#### Archived

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

# 4-connected midpoint ellipse algorithm

This topic is 5232 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
4-connected? You mean an ellipse with 4 evenly distributed points?

##### 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 on other sites
rotate your matrix if you want diagional movement.

[edited by - cibressus on May 23, 2004 9:22:24 PM]

##### 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 on other sites

This topic is 5232 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

This topic is now closed to further replies.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
16
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007271

×