Chris Zelenak has created Spacial Query a very nice library for spatial math. He told us:

I recently wrote up a library to help me with operations on polygons, and ended up adding some stuff for dealing with matrix, vector and latitude longitude primitives as well. The name is taken from the JQuery style chaining in the library, that I added just because, well…I like JQuery, and I like being able to do things like: