Trackball C++ code without quaternions

I'm leaving some code to handle a simple trackball. The code actually wasn't done by me, but I can't remember where I took it! Originally it was C code which I've wrapped up in a C++ class with way more comments and an example of how to use it. [  C++ trackball code ].