Ok, i think i have my head around most of it now, but now i find im falling at the first hurdle! Calculating the surface normals. I'm testing for other surfaces.

I had been using these for a three dimensional rotation.

Rotation matrix - Wikipedia, the free encyclopedia

To clarify, what i had been doing was, as it is a 3D rotation, substituting 45^ (or whatever angles I choose for a test) into two rotation matrices, depending on what two axis i am rotating around.

I then multiply Rx x Ry x Rz, as it mentions further down for matrix multiplication.

For the 45^ multiplication, I got

Code:

0.7071 -0.7071 0
0.5000 0.5000 -0.7071
0.5000 0.5000 0.7071

But now i think i should be doing it this way

Step 1: I take the three rotation matrices, and rotate them around different axes, by a set number of degrees. This means substituting 45^ for theta in each. I then multiply Rx by Ry by Rz. This gives me a 3 x 3 matrix, like i have above.

Step 2: I then take the surface normals of the plane before I rotated it, 1,0,0 for vertical, or 0,0,1 for horizontal, and multiply this 3x1 matrix by a 3x3, giving me a 3x1 matrix.

Im not sure if im right though...