A Monkey's Guide to Matrices

The sample

In the course of trying to enhance the glxCamera class in the ocx on this site, I found I didn't understand enough about matrices. I built the sample app so I could see exactly what was going on. The sample contains 2 objects – a camera (yellow box) and a model (white box). The panel on the left shows the current matrix for each object. The matrix is implemented as a VB class and contains a child class which draws the xyz axes of the matrix. On the panel you can select an active axis and a transformation from the comboboxes, then use the Up (or Right) and Down (or Left) arrow keys to transform the model or the camera. The objects can be transformed around their local axes, the world axes, or an arbitrary axis. The local axes can be selected by picking them with the mouse, but the other axes must be selected using the comboboxes.

In the first image we are standing outside of the camera and viewing it as an object. In the image below, we are viewing from the camera. The yellow box is the camera icon and the blue ball represents the other viewpoint ('from outside').

Загрузка...