Consider the situation where a point p rotates around a normalized vector nˉ by α. Let p′ be the rotated point and r be the intersection between nˉ and the plane where p is rotating. As above, nˉ passes through (0,0,0), Even though nˉ can be in any direction and pass any point, this vector can be translated so that it passes through (0,0,0) keeping the direction. So, this assumption is still valid for simplicity. Now, the following equations are derived from the dot product and cross product. ⟹⟹p′=r+q′q′=qcosα+(nˉ×q)sinαr=(nˉ⋅p)nˉq=p−r=p−(nˉ⋅p)nˉnˉ×q=nˉ×(p−(nˉ⋅p)nˉ)=nˉ×pp′=(nˉ⋅p)nˉ+(p−(nˉ⋅p)nˉ)cosα+(nˉ×p)sinα
Looking into the (nˉ⋅p)nˉ part from the point of view of matrix form, (nˉ⋅p)nˉ=(nˉxpx+nˉypy+nˉzpz)⎝⎛nˉxnˉynˉz⎠⎞=⎝⎛nˉx2px+nˉxnˉypy+nˉxnˉzpznˉxnˉypx+nˉy2py+nˉynˉzpznˉxnˉypx+nˉynˉzpy+nˉz2pz⎠⎞=⎝⎛nˉx2nˉxnˉynˉxnˉynˉxnˉynˉy2nˉynˉznˉxnˉznˉynˉznˉz2⎠⎞⎝⎛pxpypz⎠⎞=⎝⎛nˉxnˉynˉz⎠⎞(nˉxnˉynˉz)p=(nˉ×nˉt)p
As such, the (p−(nˉ⋅p)nˉ)cosα part also can be rewritten as follows. (p−(nˉ⋅p)nˉ)cosα=cosα(p−(nˉ×nˉt)p)=cosα(I−nˉ×nˉt)p
The (nˉ×p)sinα part also can be reformed by skew-symmetric matrix. S=⎝⎛0nˉz−nˉy−nˉz0nˉxnˉy−nˉx0⎠⎞⟹(nˉ×p)sinα=sinαSp
Now, let R=nˉ×nˉt+cosα(I−nˉ×nˉt)+sinαS. Then p′=Rp. Therefore, this R is the rotation matrix. R=⎝⎛(1−cosα)nˉx2+cosα(1−cosα)nˉxnˉy+nˉzsinα(1−cosα)nˉxnˉz−nˉysinα(1−cosα)nˉxnˉy−nˉzsinα(1−cosα)nˉy2+cosα(1−cosα)nˉynˉz+nˉxsinα(1−cosα)nˉxnˉz+nˉysinα(1−cosα)nˉynˉz−nˉxsinα(1−cosα)nˉz2+cosα⎠⎞
Keep going!Keep going ×2!Give me more!Thank you, thank youFar too kind!Never gonna give me up?Never gonna let me down?Turn around and desert me!You're an addict!Son of a clapper!No wayGo back to work!This is getting out of handUnbelievablePREPOSTEROUSI N S A N I T YFEED ME A STRAY CAT