|
![](/i/fill.gif) |
Glad it helped you.
Once you find how to rotate a vector around an axis, the rows of the
matrix are the rotation of the vectors x, y and z. Here is a shorter
code for the matrix
#macro matrot(axis ang)
#local mv = vnormalize(axis); #local ma = radians(ang);
#local a1 = mv.x; #local a2 = mv.y; #local a3 = mv.z;
#local sa = sin(ma); #local ca = cos(ma); #local dc = 1 - ca;
matrix <
a1*a1*dc + ca, a1*a2*dc + sa*a3, a1*a3*dc - sa*a2,
a2*a1*dc - sa*a3, a2*a2*dc + ca, a2*a3*dc + sa*a1,
a3*a1*dc + sa*a2, a3*a2*dc - sa*a1, a3*a3*dc + ca,
0, 0, 0
>
#end
Alberto.
Post a reply to this message
|
![](/i/fill.gif) |