freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Problems with bbox code and cubic bezier curves


From: Werner LEMBERG
Subject: Re: [Devel] Problems with bbox code and cubic bezier curves
Date: Tue, 24 Apr 2001 14:33:01 +0200 (CEST)

> ... sqrt is pretty cheap.  you can do it something like 100
> instructions.  Just look for code snippets (I found one here that is
> written optimised pentium code that has a longest path of about 20
> instructions.  Not that we would want to use asm).
> 
> The basic method is:
> 
> given A
> find top 1 bit = tb 
> get top 8 bits eb = A >> (tb - 8)
> lookup sqrt approx from table = sqroot[eb]
> shift to half way to top bit x = (sqroot[eb] << (tb/2)-8)
> feed to newton-raphson approximation: 1/2(x+A/x)
> this converges quadratically, so with a good initial guess(the shift
> and lookup) we should have a sqrt in vert few cycles.

Similar code is already in ftcalc.c, for both 32bit and 64bit
integers.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]