matrix and rotation

Hy.
I have little mesh of 6 3dpoints(x,y,z) and i would rotate these 6 point by the 2 input axis direction.
I try to create a 3x3 rotation matrix and multiply it by 3dpoints
.
I transform all 3dpoint to a vector and multiply it by a matrix create from the axis.
but how i can create this matrix?
I have y axes and z axes directions.
is possible?
Thanks.

First, obtain the X axis from the Y and Z:

X = crossProduct( Y, Z )

Then simply:


matrix[0,i] = X.i
matrix[1,i] = Y.i
matrix[2,i] = Z.i

Where i takes the values 0, 1 and 2

Note that you must normalize Y and Z first of all (before calculating X), and of course Y and Z must be orthogonal.

If Y and Z are not orthogonal, the solution is simple: once you have calculated X, recalculate Z with: Z = crossProduct( X, Y ). If you want to modify Y instead of Z, then do Y = crossProduct( Z, X ).

If it doesn’t work, try swapping the matrix indexes, i.e. instead of matrix[0,i] = X.i try matrix[i,0] = X.i, because it depends on the language you’re programming on.