> I was thinking that since
> recursion is commonly used in hardware (think flip-flops),

Flipflops are just storage cells.  How do you think recursion is involved there?

Petter put it better than I did - feedback is the right word.

Are you saying that your recursion is only three levels deep?

The recursion part is in determining what points on the curve need to be drawn.  I'll just start from basics:

A cubic bezier curve is defined by four control points - the first and last are the beginning and ends of the curve, while the other two help describe its shape.  DeCasteljau's algorithm is used to determine points on the curve - f(t) -> (x,y) where t is between 0 and 1 inclusively.  So, the lazy way to approximate a bezier curve is to calculate points for values of t ranging from 0 to 1 on even (or cleverly determined) intervals and draw lines between them. 

What I'm doing is using a different approach.  It's really easy to figure out the control points for the two curves comprising the first and last halves of the original bezier curve.  So, since we're working in pixel space, I recursively divide the first and last halves of curves that lie along the original curve until the beginning and end points are touching (in pixel space).  Once that happens, I draw a pixel with coordinates of the first and last control points, and go on to the next sub-curve.

So, this is pretty easy in c (especially with floating point, but I did a fixed-point version that works well too).  I'll post that code in a little bit, and then work on converting it to an explicit stack.

The part that's a three-level deep pipeline is the calculation of the control points for the first and last halves of the sub-curve.  You could constantly push the four controls for your current curve into the module and somewhere else handle them, but I can't quite see how it would work in hardware.  I'm still thinking in software, I guess.  I'll work on that :)

_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)

Reply via email to