Welcome! Log In Create A New Profile

Advanced

midpoint circle for all eight octants?

Posted by jgilmore 
midpoint circle for all eight octants?
September 08, 2008 05:01PM
I've been trying to generalize the midpoint circle algorythm to all eight octants. I figured out how to start a python interpreter here at work, so that's what I've been doing between using to test the modified algorithm.

I've got something that works, but it's ugly. The "advance to next octant" conditional is different for each octant. The "error +=" statments comes either before or after each axis increment, depending on if it's increasing or decrease the abs() of the distance to the center of the circle. This is based on keeping track of the combined square roots of the two (x&y) coordinates using (n+1)^2 - n^2 = n*2 + 1. The independant axis (and the test for incrementing the other axis) change for each octant as well. And though it's definately a circle, it's not 100% symetrical like I think a circle should be.

On top of that, I can't test it for large values of (radius) because of Java heap problems... that's probably a leak in the jython compiler or the JVM being stupid.

Now that I've got it to work (in python) and deciding I still don't like the way it looks (specifically, it looks like it'll take up far too much code space once translated to cpp and loaded on the arduino) I though I'd post it here and see if anybody had any bright ideas for reducing the space the code takes up.

I've basically got the G-code interpreter switched over to interrupt-based line drawing, needs more testing which will have to be delayed to wednesday at the earliest. I'm wanting to add extruder feedback support too, but since the experimental extruder feedback support wouldn't load b/c it was too large (compiler versions?) I'm worried that there just isn't any way to get it all into the arduino, and I'll have to spend more money and upgrade to the sanguino... I really don't want to do that. But I also really want the extruder feedback AND true arc support. And I'm afraid that without interrupt based drawing it'll leave blobs.

So, to sum up, we need to include in approximate priority order:
1. Interrupt-driven queue-fed line/arc drawing.
2. Extruder feedback control
3. Midpoint circle algorithm arc drawing (preferably arc & helix drawing)
4. Full PID extruder (and maybe heater too) control.

These are listed also listed according to which changes will have greatest impact on build quality. That's according to my reading of the forums of course, since I'm still waiting on nichrome wire for my extruder, and drill bits, and time to put it all together, and I still need to find some 1/8" ID teflon tubing, etc. So I haven't printed even a blob yet. And I need to test the bit of mouse I whacked off to make the feedback wheel for the extruder.

The more I get into this, the more time it seems like it takes! I suppose that's what some people want in a hobby, and I don't mind spending some time on it. I'm starting to get impatient for my first plastic parts though.


--
I'm building it with Baling Wire
Attachments:
open | download - Bresenham Arc v1.txt (5.9 KB)
Anonymous User
Re: midpoint circle for all eight octants?
September 13, 2008 05:22AM
genrate arc from I,J prameter OK but how to generate arc or circle if know only R radius????

regards
Sorry, only registered users may post in this forum.

Click here to login