I I would like o know if there is a direct way to get the quaternion representing the rotation of a vector that lies on one of the axes (the Z axis for instance), when I have the x,y,z components of the resulting vector.
In the image above, I have the x,y,z components, and I want to rotate an object (a pen for instance) with origin in 0,0,0 and parallel to the Z axis, into a pen with same direction of the vector in figure.
I could for sure use the components to get the 3 euler angles (tan-1(y/z), tan-1(y/x), tan-1(x/z) ) and then convert to quaternion. But I was wondering if there is a better way. I'm using Qt (http://doc.qt.io/qt-5/qquaternion.html), but if there is a simple formula I could implement it in C++. Thank you