### Archive

Posts Tagged ‘algorithms’

## Time To Say Goodbye

When I started this blog, I wasn’t sure how much time I would devote to blogging, so I took the free WordPress route. I’ve been incredibly busy over the last year and a half and the lack of posts reflects that situation. I’m now in a position to devote a small amount of time to blogging and I decided to take the leap into the 21st century and create a WordPress site at algorithmist.net (my business site).

Since I now have a blog at my site, I will no longer maintain this one.  I will leave all the posts online since many of them have code samples from which readers may realize some benefit.

I will continue blogging about math and programming, just in a different place.  I hope you enjoyed the content of this blog and will keep up with the new one.

thanks!

– jim armstrong

Categories: General Tags: , ,

## haXe and fast inverse square root

Inverse square root is a common operation in vector normalization, something that happens a lot in 3D math, particularly in game engines.  An incredibly clever algorithm was developed using so-called ‘magic numbers’ and implemented in C, making its production debut in Quake.

Essentially, the algorithm makes a very smart guess as to an initial starting point that can be used to drive a single iteration of Newton’s method for 1/sqrt(x).  You can read more about it here,

http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/

http://www.geometrictools.com/Documentation/FastInverseSqrt.pdf

Some time ago, I gave this approach a try using ByteArray and was disappointed with the performance, although it was a fun exercise.  Recently, Nicolas Cannasse implemented the algorithm with haXe optimizations and the performance is awesome.  Great work Nicolas!

Categories: Flash, Math