# How to calculate rotation angle to get a set distance between two vector end points

The situation:

In 3D space there are two vectors (A, B) of equal length L, but with different directions.

The beginning points of these vectors are located at a distance of L as well. They could be visualized like this (angles are not equal, both are beginning at the bottom of the image and going up):

        Y
A ->  \_|/  <-B
L


The problem:

I need to determine an angle alpha, by which to rotate vector B around axis Y (Which is given as one of vectors orthogonal to the line between the beginnings of A and B) to reach a situation, where the endings of A and B are also at distance L (Basically to get a 3 dimensional shape from 4 vectors with equal length) If it is hard to calculate an angle, a method for finding coordinates forone of the possible new endpoints for B would also be ok.

The question is:

How can I calculate this angle (one of the two angles), and how can I determine if for given vectors it is even possible to do?

Best I can tell, this is an application of Rodrigues' rotation formula. If you provide the axis of rotation $\hat{Y}$, and angle of rotation $\theta$, then the rotation formula returns a rotated vector: $$\vec{A} = \vec{B}\cos\theta + (\vec{B} \times \hat{Y})\sin\theta + \hat{Y}(\hat{Y}\cdot \vec{B})(1-\cos\theta)$$ Note that depending on your basis vectors and whether you measure the angle clockwise or counterclockwise, the middle term $\vec{B} \times \hat{Y}$ may be reversed: $\hat{Y} \times \vec{B}$. See the Wikipedia article for reference.
Concerning the last difficulty about the tails of $\vec{A}$ and $\vec{B}$ remaining a distance $L$ from each other, if you can additionally provide the direction of $\hat{L}$, then you should be able to apply the rotation formula as if the two vectors originate from the same point and then shift the resultant vector such that $\vec{A}_{\text{shifted}}=(\vec{A_{\text{tip}}}+\vec{L})-(\vec{A_{\text{tail}}}+\vec{L})$, where $\vec{A_{\text{tip}}}$ and $\vec{A_{\text{tail}}}$ are measured relative to the origin.