I suppose so.  The other option would be to use the other formula for
drawing a bezier curve.  It looks something like:

          3
         ___
  x(t) = \   ( 3 ) * x  * t^i * (1-t)^(3-i)
         /   ( i )    i
         ---
         i=0

          3 
         ___
  y(t) = \   ( 3 ) * y  * t^i * (1-t)^(3-i)
         /   ( i )    i
         --- 
         i=0

(t runs from 0 to 1)

Where the first coefficient is the binomial coefficient (ie. 1 for i = 0
or 3, 3 for i = 1 or 2).  This way you could decide on a fixed number of
points (say 10 or 20), and calculate them.  By precomputing the powers of
the various values of t, to calculate each point you would only need 24
multiplications and 6 additions.  Also, the process is constant time
rather than a recursive algorithm.  This is potentially not as high a
quality, but may be sufficient for on screen display.

Another place to look is the algorithms used in libart from gnome-libs (in
the art_vpath_bpath.c file).  It looks like it uses a similar approach to
dia's renderer, except that it looks at `smoothness' to decide when to
break out of the recursion rather than spacing of the points.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 26 Oct 1999, Alexander Larsson wrote:

> On Tue, 26 Oct 1999, James Henstridge wrote:
> 
> > The one problem with this patch is that it will not draw valid beziers
> > where the start and end points are the same (ie. a closed curve made of
> > one bezier).  I don't know if this is a big problem or not though.
> > Perhaps the other points in the bezier should be taken into account.
> 
> Yes, this is true. But from what i can read that would have had problems
> before too (division by zero).
> 
> Would this be fixed if we always subdivide at least once?
> 
> / Alex
> 
> 

Reply via email to