[Math] Rotate a vector in 4D space

analytic geometryeuclidean-geometrygeometrymatricesrotations

Given 2 vectors $m$, $n$ and point $p$ which define a rotation plane $P$ in 4-dimensional space $R^4$, how can I rotate any vector/point $v$ by angle $a$?

This question is a continuation of another question at gamedev, where I asked how I could rotate a camera in 4D space.
I've later found out that the answer was not sufficient, because it rotates the 3 orthonormal vectors (the fourth can be calculated) defining the direction of the camera in planes defined by vectors of the canonical basis. What I would like to achieve, is to rotate the camera in the rotation plane defined by 2 of the 4 vectors defining the direction of the camera and its location.

Best Answer

Suggestion: Move your origin to $p$, orthonormalize $m,n$ to get $e_1$,$e_2$ and supplement with two orthonormal vectors $e_3,e_4$. Let $E=[e_1\ e_2\ e_3 \ e_4]$ denote the (4 by 4) matrix of these column vectors.

A vector in these coordinates is described by $v=Ex$ with $x\in {\Bbb R}^4$.

A rotation in the plane spanned by $e_1,e_2$ is given by $f_a(Ex)=E M_a x=E M_a E^{-1} v= E M_a E^T v$ with $$ M_a=\left( \begin{matrix} \cos a & -\sin a & 0 & 0\\ \sin a & \cos a & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{matrix} \right)$$