'Find 2 rotation angles of independent axes to form collinear vectors

I have a problem where I have already tried a lot and can't really come to a solution. Suppose I have two axes in space given by vectors. Furthermore, I have a vector on each axis, which rotates with the rotation of the corresponding axis.

For example Axis 1 (0,0,1) with vector 1 (0, 0.316, 0.949) and axis 2 (0, 0.707, 0.707) with vector 2 (0, 0, -1)

I am now looking for a way to determine the angles of axes 1 and 2, where the two vectors are collinear and point to each other. In the above example, there are 2 solutions. I do not assume the special case that there are infinite solutions.

I have already tried some approaches with 4x4 matrices, quaternions or Rodrigues rotary formula. Unfortunately, I can't find a suitable and general way.

Would be great if someone could help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source