Generate a rotation matix to rotate [ 1 1 1 ] to [ 0 1 0 ] Vectors are normalised and rotation is by the minimal amount. Axis of Rotation (n) = [ -0.707107 0.000000 0.707107 ] Matrix to rotate Z axis to n => Q [ 5.773502691896E-01 5.773502691896E-01 5.773502691896E-01 ] [ -4.082482904639E-01 8.164965809277E-01 -4.082482904639E-01 ] [ -7.071067811865E-01 0.000000000000E+00 7.071067811865E-01 ] Rotate around Z axis => T [ 5.773502691896E-01 8.164965809277E-01 0.000000000000E+00 ] [ -8.164965809277E-01 5.773502691896E-01 0.000000000000E+00 ] [ 0.000000000000E+00 0.000000000000E+00 1.000000000000E+00 ] Resultant Rotation Matrix => R = transpose(Q) * T * Q [ 7.886751345948E-01 5.773502691896E-01 -2.113248654052E-01 ] [ -5.773502691896E-01 5.773502691896E-01 -5.773502691896E-01 ] [ -2.113248654052E-01 5.773502691896E-01 7.886751345948E-01 ] Rotate some vectors with matrix => v' = v * R v -> [ 0.000000 1.732051 0.000000 ] x -> [ 0.788675 0.577350 -0.211325 ] y -> [ -0.577350 0.577350 -0.577350 ] z -> [ -0.211325 0.577350 0.788675 ] Check orthogonaly is preserved 'x x 'y -> [ -0.211325 0.577350 0.788675 ] = 'z 'y x 'z -> [ 0.788675 0.577350 -0.211325 ] = 'x 'z x 'x -> [ -0.577350 0.577350 -0.577350 ] = 'y