How do I "change" the angle between three vectors in 3D space?

860 Views Asked by At

In this question the answer shows how to get the angle between three points in 3D space. However I would like to know how to change the angle.

For example, if I have points $A,B$ and $C$ and I want to change the $ABC$ angle (where $B$ is the middle point), I should be able to get new points $C'$ and $A'$ given points $A,B,C$, the change in angle $\frac{d\theta}{dt}$ (or simply the desired angle if I know it) and the axes of the plane described by the 3 points.

I'm not sure if I described that 100% correctly so I'll also try and explain in an intuitive way. Imagine the three points at a certain angle. If I want the angle to get smaller or bigger I want to kind of rotate points $A$ and $C$ around point $B$ towards or away from each other. They'd rotate around the (y?) axis of the plane described by the three points. In other words the three points cannot rotate in such a way that causes the plane described by these three points to also rotate. I hope that kind of makes sense.

I'm not that great at maths so a kind of step by step explanation would be appreciated so I have a chance at understanding the answer rather than just being able to use it.

2

There are 2 best solutions below

0
On BEST ANSWER

So, you have three points, $$\begin{cases} A = ( x_A ,\, y_A ,\, z_A ) \\ B = ( x_B ,\, y_B ,\, z_B ) \\ C = ( x_C ,\, y_C ,\, z_C ) \end{cases}$$ The angle $\theta = \angle ABC$ fulfills $$\cos(\theta) = \frac{ \overline{BA} \cdot \overline{BC} }{\left\lVert \overline{BA} \right\rVert \left\lVert \overline{BC} \right\rVert }$$ and $$\sin(\theta) = \frac{ \left\lVert \overline{BA} \times \overline{BC} \right\rVert}{\left\lVert \overline{BA} \right\rVert \left\lVert \overline{BC} \right\rVert}$$ where $\cdot$ denotes vector dot product, and $\times$ denotes vector cross product.

If we want to rotate $C$ around $B$ so that the angle $\angle ABC$ becomes $\theta + \varphi$, we first find the normal of the plane the three points form: $$N = ( x_N ,\, y_N ,\, z_N ) = \frac{\overline{BA} \times \overline{BC}}{\left\lVert\overline{BA} \times \overline{BC}\right\rVert}$$ If we first calculate the cross product components, $$\begin{cases} x = ( y_A - y_B ) ( z_C - z_B ) - ( z_A - z_B ) ( y_C - y_B ) \\ y = ( z_A - z_B ) ( x_C - x_B ) - ( x_A - x_B ) ( z_C - z_B ) \\ z = ( x_A - x_B ) ( y_C - y_B ) - ( y_A - y_B ) ( x_C - x_B ) \end{cases}$$ we get the components of the normal vector $N$ by "normalizing" the length of the resulting vector to unit length, or 1: $$\begin{cases} x_N = \frac{x}{\sqrt{x^2 + y^2 + z^2}} \\ y_N = \frac{y}{\sqrt{x^2 + y^2 + z^2}} \\ z_N = \frac{z}{\sqrt{x^2 + y^2 + z^2}} \end{cases}$$ We now simply need to rotate $\overline{BC}$ around the vector $N$ by angle $\varphi$.

We can do that by applying Rodrigues' rotation formula to $\overline{BC} = ( x_C - x_B , y_C - y_B , z_C - z_B )$, to get the new position $C'$ relative to $B$. Essentially, $$C' = B + \overline{BC} \cos(\varphi) + \left( N \times \overline{BC} \right) \sin(\varphi) + N \left( N \cdot \overline{BC} \right) \left(1 - \cos(\varphi) \right)$$ Note that the definition of $\theta$ (and the rotation angle $\varphi$) above define it as positive counterclockwise. If $\angle ABC$ is clockwise — that is, $A$ is to the right of $C$, when viewing from $B$ —, then $\theta$ is negative, and a positive $\varphi$ will then decrease the angle.

If you want to rotate both $A$ and $C$ by the same amount, so that the angle $\angle ABC$ changes from $\theta$ to $\theta + \varphi$, you rotate $A$ by $-\varphi/2$ and $C$ by $\varphi/2$: $$A' = B + \overline{BA} \cos\left(\frac{\varphi}{2}\right) - \left( N \times \overline{BA} \right) \sin\left(\frac{\varphi}{2}\right) + N \left( N \cdot \overline{BA} \right) \left(1 - \cos\left(\frac{\varphi}{2}\right) \right)$$ because $\sin(-x) = -\sin(x)$ and $\cos(-x) = \cos(x)$; and $$C' = B + \overline{BC} \cos\left(\frac{\varphi}{2}\right) + \left( N \times \overline{BC} \right) \sin\left(\frac{\varphi}{2}\right) + N \left( N \cdot \overline{BC} \right) \left(1 - \cos\left(\frac{\varphi}{2}\right) \right)$$

0
On

With three points, there is always a unique plane passing through them. So considering this problem in 3D space is identical to doing it on a flat sheet of paper.

If your coordinates make this difficult, we can transform to better coordinates. We'll set $B$ as the origin. Letting $d_{AB}$ be the distance between $A$ and $B$, we'll put $A$ on the new $x$-axis, at the point $d_{AB}$ from the origin. Now draw a line from $C$ perpendicular to the new $x$-axis. This will be the direction of the new $y$-axis, so that all three points will be on this plane.

Once you're back in 2D, the problem should be easily visualizable.