http://blog.richardkiss.com/?p=398
The matrix math is easier, and the Python code is about a dozen lines.