public void apply(Matrix3f matrix) {
        float oldX = x, oldY = y, oldZ = z, oldW = w;
        fromRotationMatrix(matrix);
        float tempX = x, tempY = y, tempZ = z, tempW = w;

        x = oldX * tempW + oldY * tempZ - oldZ * tempY + oldW * tempX;
        y = -oldX * tempZ + oldY * tempW + oldZ * tempX + oldW * tempY;
        z = oldX * tempY - oldY * tempX + oldZ * tempW + oldW * tempZ;
        w = -oldX * tempX - oldY * tempY - oldZ * tempZ + oldW * tempW;
    }
Applies the rotation represented by the argument to the current instance.

<p>Does not verify that {@code matrix} is a valid rotation matrix.
Positive scaling is compensated for, but not reflection or shear.

@param matrix the rotation matrix to apply (not null, unaffected)
jme3-core/src/main/java/com/jme3/math/Quaternion.java