posted 11 years ago
Ok here it is. Thanks for the appreciation!
It's tricky to explain exactly how it works, but parts of it make use of the cross product and dot (also called scalar) product of two vectors. These can be looked up on wikipedia.
For the rotation, imagine the vertices as lying on a sphere with centre the same as the centre of the cube. A point on or near the cube on the screen corresponds to a point (well really two points!) on the sphere. For a mouse drag from a vertex, the program works out how the sphere has been rotated and then rotates all vertices accordingly.