# Rotation around a line which is determined by two points in 3D space

If we have three points like $A(x_1,y_1,z_1)$, $B(x_2,y_2,z_2)$ and $C(a,b,c)$. Then, $A$ and $B$ determines a line like $l$. After that, we rotate $C$ around $l$ by $\omega$ degree (anti-clockwise). How can be calculated new position of $C$ "$C'(a',b',c')$"?

• How do you define "anti-clockwise" in 3 dimensions? – JimmyK4542 Jul 31 '14 at 11:03
• yes I forgot to write it, it is right hand rule thumb point B to A – user161943 Jul 31 '14 at 11:15
• Do you want to use only elementary analytic geometry? If not, see en.wikipedia.org/wiki/Quaternions_and_spatial_rotation – user35603 Jul 31 '14 at 11:15

There are several ways to do it, it depends on what you want to do in practice. With linear algebra, this can be achieved using a simple matrix multiplication. You can define a unit vector from $A$ to $B$ to define a rotation axis, then apply the axis-angle rotation matrix on the vector of the point $C$.