[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetype-devel
Subject:    Re: [Devel] Problems with bbox code and cubic bezier curves
From:       David Turner <david.turner () freetype ! org>
Date:       2001-04-25 23:04:09
[Download RAW message or body]

Hi Tom,

> 
> Hmmm... I guess I should have been more precise.  If the control points
> for a cubic Bezier curve are (x1,y1) -- (x4,y4) and t in [0,1], then the
> parametric equations are:
> 
>   x(t) = (substitute x_i for P_i in the equations below)
> 
>   y(t) = (substitute y_i for P_i in the equations below)
> 
> Correct?
>
Definitely, and of course, z(t) if you're in 3D ;-)
 
> The only question I have is about normalising the 16.16 fixed floats to 8.16
> fixed floats.  That only allows for integer parts between -128 and +127!
>
First of all, we're not normalising 16.16 fixed floats, but arbitrary
32-bit values.. (well, to be picky, that's probably 30-bits due to the
multiplications and adds required to compute a, b, c).

Second, we use 8 bits of integer part, but the fractional 16 bits are
important in the rest of the computation. This means that we're really
using 24 bits of precision to compute the zeros of our quadratic equation.

That's largely enough in my opinion given that t is in (0..1) and is
expressed with 16 bits anyway..

If you need more accuracy, using doubles is the pratical solution :-)

I have not the courage to compute the errors produced by the use of
fixed-point arithmetic. It certainly wouldn't be trivial to compute,
and I doubt that it would be too important... probably about 0.025%
or even less..

Regards,

- David

_______________________________________________
Devel mailing list
Devel@freetype.org
http://www.freetype.org/mailman/listinfo/devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic