Rotation in 3D (coordinate system transformation)

2.9k Views Asked by At

How do I rotate a point around point [0,0,0] in 3D. In picture I draw specific situation for illustration. example

At first I know point G[x,y,z] and I will tranfer it on axiz Z, where distance to center is size of vector g. Then vectors g and gt forms angle φ. Then I get some point A and i need to rotate it same as I rotated G before. But i dont know how. I think it could be named as coordinate system transformation.

I heard i should use transform matrix. Could you please give me detailed informations?

2

There are 2 best solutions below

3
On BEST ANSWER

The @bubba answer is totally fine. Also note that you can compute your rotation axis by taking the cross product of $G$ and $G_t$. Supposing that $G=[x,y,z]$ and $G'=[x',y',z']$, the coordinates of $G\times G_t$ are given by $$ G\times G_t = [yz'-y'z,\;zx'-z'x,\;xy'-x'y]. $$ Also note, that these guys are the minors of the following matrix $$ \begin{bmatrix} * & * & * \\ x & y & z \\ x' & y' & z' \\ \end{bmatrix} $$ taken with "+" or "-" sign as in the Laplace decomposition. This also explains why the vector $G\times G_t$ is perpendicular to both $G$ and $G_t$ while staying linearly independent (hint: put the coordinates of $G$ or $G_t$ in place of the star symbols and see what happens). Good luck!

0
On

You need to know the axis around which you're going to rotate. This is some line passing through $(0,0,0)$, so all you need is a unit vector parallel to this line. Suppose this unit vector is $\mathbf{u} = (u_x, u_y, u_z)$. Then you plug this vector and your angle $\theta$ into the formula given on this wikipedia page to get the rotation matrix.

To rotate any given point, you just multiply its coordinates by this rotation matrix.