Thanks. If I expect a piece of code to survive any length of time I try to document it well because I tend to forget how/why I decided to do things. In that piece of code, I knew that I'd forget the trig. part quite quickly so I figured an ASCII diagram was needed.
Awesome! I hate seeing people say "Make good comments, not like X". I have given up on asking "what would be a good comment" because no one seems to be able to point to a good example. This will be much helpful :).
If you enjoyed that piece of code you might also enjoy the C code linked here: http://blog.jgc.org/2008/02/tonight-im-going-to-write-myself...
Perhaps there should be a 'beautiful code' blog as a sort of counterpart to the Daily WTF. I could reuse the domain usethesource.com.
Update: An there it is UseTheSource (http://news.usethesource.com/news). Submit examples of beautiful or interesting code.