[Papervision3D] Spatial distance between points... and optimizing Sqrt?

joa e. j at je2050.de
Tue Aug 28 03:25:28 PDT 2007


I tried it and of course the ByteArray stuff withou any other 
calculation is already slower than 1/sqrt.
Anyways the function using some more iterations and a worse guess is not 
that bad at all.
Actually the real optimized function does not make any sense for us 
since we can not access the bits
of a float (for instance Number(2.123).toString(2) returns you 10 as 
well...).

Building your own 4b out of a float is then one thing to run the 
optimized function. But after you did the
nice tricks you have to convert that int back into a float again. The 
idea is to remove some calculations :)

For me it ends here, hehe. By the way, Math.pow(x,-0.5) is also way 
slower than 1/Math.sqrt(x).


Cheers


Ralph Hauwert schrieb:
> IMHO bytearray is quite slow. Many lookups will cost alot of cycles. 
> Let's try and solve this without ?
>
> On 8/27/07, *Tim Knip* < tim.knip at gmail.com 
> <mailto:tim.knip at gmail.com>> wrote:
>
>     Yeah, with ByteArray.writeFloat we can get the 4 bytes as int.
>     Trouble is other way round (later in the function), there we need the
>     int to be interpreted as float :(
>     Maybe its possible to do some ByteArray hacking here too, but...
>     ByteArray access seems reasonably fast, but i beleive its a tat
>     slower
>     then normal Array access.
>
>     Guess your proposed function would be better :)
>
>     T
>
>     _______________________________________________
>     Papervision3D mailing list
>     Papervision3D at osflash.org <mailto:Papervision3D at osflash.org>
>     http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
>
> -- 
> Ralph Hauwert
> ------------------------------------------------------------------------
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>   




More information about the Papervision3D mailing list