[Gllug] Faster maths?

salsaman salsaman at xs4all.nl
Fri Mar 9 17:27:53 UTC 2007


Adrian McMenamin wrote:

>On Fri, March 9, 2007 4:25 pm, salsaman wrote:
>  
>
>>Richard Jones wrote:
>>
>>    
>>
>>>There's a fast, high-quality implementation of this algorithm in the
>>>source code to xv.  Unfortunately it has a non-free license ...
>>>
>>>      
>>>
>
>Is it? Quite a lot of the code seems BSD type licenced, but I haven't
>looked through all of it and clearly there is a charge for something or
>other - but its all in C and I am writing perl anyway, so not sure what
>the legal position is...
>
>  
>
>>Well, I already posted one algorithm you could use: 3d cube mapping. But
>>if you want to  ignore that and calculate the inverse sqrt quickly, use
>>the hack from ID software:
>>
>>http://www.codemaestro.com/reviews/review00000105.html
>>
>>Gabriel.
>>
>>    
>>
>
>Actually, Gabriel, not sure how practical your algorithm is, as the
>efficency of the median cut is that you decide which axes along which to
>cut by shrinking every box to the minimum size and then cutting that.
>
>
>
>  
>
Sure. That doesn't change. What I suggested can be stated another way: 
keep the same boxes, but just note the corners of each box and their 
relative positions. Then when you dither the value of a pixel, you 
follow its path through the 3d space and see which boxes it passes 
through. If it ends up outside all boxes, you only need to compare its 
position with the nearest faces of the last box passed through and its 
nearest neighbours. So there is no need to do any multiplication at all. 
Try to visualise the 3d map of the boxes and you will see what I mean.

Gabriel.


-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list