public Matrix4 setToRotation ( float angle , float x , float y , float z ) { float c = FloatMath . cos ( angle ) , s = FloatMath . sin ( angle ) , omc = 1f - c ; float xs = x * s , ys = y * s , zs = z * s , xy = x * y , xz = x * z , yz = y * z ; return set ( x * x * omc + c , xy * omc - zs , xz * omc + ys , 0f , xy * omc + zs , y * y * omc + c , yz * omc - xs , 0f , xz * omc - ys , yz * omc + xs , z * z * omc + c , 0f , 0f , 0f , 0f , 1f ) ; }
Sets this to a rotation matrix . The formula comes from the OpenGL documentation for the glRotatef function .