Matrix3f matrix = new Matrix3f(); matrix.set(0, 0, (1.0f - 2.0f * (y * y + z * z))); matrix.set(0, 1, (2.0f * (x * y - w * z))); matrix.set(0, 2, (2.0f * (x * z + w * y)));   matrix.set(1, 0, (2.0f * (x * y + w * z))); matrix.set(1, 1, (1.0f - 2.0f * (x * x + z * z))); matrix.set(1, 2, (2.0f * (y * z - w * x)));   matrix.set(2, 0, (2.0f * (x * z - w * y))); matrix.set(2, 1, (2.0f * (y * z + w * x))); matrix.set(2, 2, (1.0f - 2.0f * (x * x + y * y)));
matrix.set(kRot);
    public Matrix3f toRotationMatrix( ) {                Matrix3f matrix = new Matrix3f();        matrix.set(0, 0, (1.0f - 2.0f * (y * y + z * z)));        matrix.set(0, 1, (2.0f * (x * y - w * z)));        matrix.set(0, 2, (2.0f * (x * z + w * y)));                // Second row        matrix.set(1, 0, (2.0f * (x * y + w * z)));        matrix.set(1, 1, (1.0f - 2.0f * (x * x + z * z)));        matrix.set(1, 2, (2.0f * (y * z - w * x)));               // Third row        matrix.set(2, 0, (2.0f * (x * z - w * y)));        matrix.set(2, 1, (2.0f * (y * z + w * x)));        matrix.set(2, 2, (1.0f - 2.0f * (x * x + y * y)));                return matrix;                }