I am not very good at math. I have a problem where I have two arbitrary 3D points. I also have a disc facing in the Y (up) direction with it's center on one of the points. How do I calculate the rotational values of the disc to make it face the other point?
2026-03-27 19:08:29.1774638509
On
3D vector question
150 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
If I understand correctly, you are after the angle between the disk normal ($Y$ axis) and the line between the points, which corresponds to a vector $\vec{ab}\equiv(b_x-a_x,b_y-a_y,b_z-a_z)$.
The cosine of this angle is given by the dot product of a unit vector in the direction of $Y$ and a unit vector in the direction of $ab$. Hence
$$\cos\phi=\frac{b_y-a_y}{\sqrt{(b_x-a_x)^2+(b_y-a_y)^2+(b_z-a_z)^2}}.$$
The only important quantity is the vector from the center of the disc to the other point: $\vec{n}=\vec{r}_2-\vec{r}_1$. You now just need to point the old normal, which was in direction $\vec{n}_0=\{0,1,0\}$ into the new direction $\vec{n}$ which you should probably normalize (divide by its length).
Now, the vector $\vec{n}_0\times\vec{n}$ tells you everything. Its direction is the axis around which you have to rotate (it will be perpendicular to $y$ and to the new axis). Its length is $\sin\phi$ where $\phi$ is the amount you have to rotate around this axis. The only thing left to check is if $\phi$ is below or above $90^\circ$ (you get two solutions with the same $\sin\phi$). You check this by looking if $y$ component of the new normal is positive or negative (if the axis points above or below the equator).