Quaterion selective rotation

Hello,

I’m working on a game, and I found some trouble with World Editor - rotation of obiects. Only rotating of vector works and dunno how to implement rotating around that vector of obiect.

_rv[4] is _rv[0] - rotation angle , _rv[1…3] - vector of quaternion
cx - cy is how much we want to rotate ( in radians )

    
if( i == 0 && rv ){ //rotacja pochylenia
     Vector3f vec = RotateVector3f( _rv[1], _rv[2], _rv[3] , cx - cy );
     vec . normalize();
     quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 );
     quat . normalize();
     } else
    if( i == 1 && rv ){ // Rotation via OZ axis ony .. ???
     Vector3f vec( _rv[1], _rv[2], _rv[3] );
     vec . normalize();
     quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 ); //( RotationQuaternion( vec , cy - cx ) * RotationQuaternion( kXaxis , (float)M_PI_2 ) ) * RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 );
     quat . normalize();
     } else
    if( i == 2 && rv ){ // stopień nachylenia
     Vector3f vec( _rv[1], _rv[2], _rv[3] );
     vec . normalize();
     quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 + ( cx - cy ) );
     quat . normalize();
     }

Image to ilustrate:

X - Blue ( i == 0 )
Y - Green ( i == 1 ) ?? We are looking it ??
Z - Red ( i == 2 )

Rotating X we rotate also Z one. If someone has an idea how to compute the Y one, please write. Thanks.

[ SOLVED ]



     Matrix4x4f matrix; // obrót obiektu względem nachylenie .. ???
     
     glPushMatrix();
     glLoadIdentity();
     glRotatef( _rv[ 0 ] , _rv[ 1 ] , _rv[ 2 ] , _rv[ 3 ] );
     glRotatef( ( cy - cx ) / Pidiv180 , 0 , 1 , 0 );
     glGetFloatv( GL_MODELVIEW_MATRIX, matrix._m );
     glPopMatrix();
     
     quat . fromMatrix( matrix );
     quat . normalize();