1
$\begingroup$

I would like to calculate an $(n \times n)$ rotation matrix in the $n-dimensional$ space given the following:

  1. An angle of rotation.
  2. An axis of rotation (an $(n-2)$ subspace that passes through the origin given by $(n-2)$ unit vectors that span the subspace).

For $n=3$, I know how to do it. there's also a function in matlab that can do it for you (vrrotvec2mat). But I don't know how to do it for $n>3$. I'm not even sure if there's a unique rotation matrix for this purpose. If there's more than one, I don't mind which rotation matrix to use.

My goal is eventually to write the implementation in matlab (or use an existing one if exists). But if anyone here can show me the mathematical way I will be able to translate it to matlab code.

Here's an example to what I need (for $4D$ since I already know how to do it for $3D$):

Say we have these two orthogonal vectors that span a plane in $4D$ (that passes through the origin):

$v_1$ = [-0.5601, 0.7248 -0.3440 -0.2064]

$v_2$ = [-0.7001 -0.3440 0.5700 -0.2580]

and say we have the angle $\theta=30^\circ$.

I want to calculate the rotation matrix $R$ that rotates any point by $\theta=30^\circ$ around the above plane. Meaning, any point $p$ that I choose in $4D$, the new point $Rp$ will be $p$ rotated by $\theta=30^\circ$ around the above plane.

Thanks in advance!

$\endgroup$

1 Answer 1

0
$\begingroup$

One strategy might be based on finding orthogonal complement ($n-2$ subspace) generated by orthonormal vectors $v_1,...,v_{n-2}$ (which is given in conditions of the task, but it can require to find orthonormal basis as it is not said that vectors are orthogonal only they are unit) to 2-dimensional subspace spanned by vectors $a,b$ representing initial and final point. (WLOG let them be unit vectors, if not scale them appropriately).

In this 2-d subspace additionally we could have some unit vector $a_\perp$ which is orthogonal to initial vector $a$ and unit vector $b_\perp$ which is orthogonal to $b$ (two possibilities for $b_\perp$, one possibility should be eliminated with the use of angle of rotation - it should be the same between $a,b$ and between $a_\perp ,b_\perp $ ).

Now we have two sets of orthogonal matrices with $n$ vectors $A=[a \ \ a_\perp \ \ v_1 \ \ \dots \ \ v_{n-2}] $ and $B=[b \ \ b_\perp \ \ v_1 \ \ \dots \ \ v_{n-2}] $.

Then we have $B=RA$ and the searched rotation matrix $R=BA^{-1}$.

In case of doubts try to visualize this for 3-dimensional case and extend it for n-dimensional case.

$\endgroup$
9
  • $\begingroup$ I'm not sure what you did. I didn't see where you used the angle of rotation. and also, the axis subspace (of n-2 dimensions) is not necessarily perpendicular to the initial and final points. I updated my question and deleted the assumption that I have the initial and final points (since I realized that they have nothing to do with calculating the rotation matrix). all I have is the angle and the axis subspace. I want to use them both in order to calculate the rotation matrix. then I can use ANY point (doesn't need to be perpendicular to the axis) and rotate it by the rotation matrix. $\endgroup$
    – David
    Commented May 16, 2018 at 1:44
  • $\begingroup$ The function vrrotvec2mat in matlab does exactly that for 3D. it gets an angle and a unit 3D vector (axis of rotation). and returns the rotation matrix. it doesn't mind which point I want to rotate. I want to do exactly the same thing but for the general n dimensions (looking for the mathematical way that uses only the axis and the angle). $\endgroup$
    – David
    Commented May 16, 2018 at 1:56
  • $\begingroup$ @David Did I not present the method for n dimensional space ? What is unclear? If you have full set of n linearly independ. vectors and their transformations it's easy to do .. To have some initial and final point of rotation was convenient for identification the subspace and also vectors orthogonal to these given lying in the subspace ( using decomposition into projected part and the orthogonal part of the vector onto the line of other vector), anyway you can identify this subspace as the orthogonal complement to the "axis" subspace.. (nullspace of transpose of axis column space) .. $\endgroup$
    – Widawensen
    Commented May 16, 2018 at 7:52
  • $\begingroup$ I don't have full sets of $n$ linearly independent vectors. I have $(n-2)$ orthogonal vectors. You said: "finding orthogonal complement to 2-dimensional subspace spanned by vectors a,b representing initial and final point". But as I said, the $(n-2)$ subspace is not necessarily perpendicular to the plane spanned by the initial and target points ($a$ and $b$). You may of course assume that the given $(n-2)$ vectors are orthogonal to each other. but not to the plane spanned by $a$ and $b$. $\endgroup$
    – David
    Commented May 16, 2018 at 13:47
  • $\begingroup$ Also, when you built the rotation matrix R, you used $A=[a \ \ a_\perp \ \ v_1 \ \ \dots \ \ v_{n-2}] $ and you said $A$ is orthogonal. Again, $a$ is not necessarily perpendicular to the subspace of rotation spanned by $[\ v_1 \ \dots \ \ v_{n-2}] $ and therefore $A$ is not orthogonal. The same thing with $B$. $\endgroup$
    – David
    Commented May 16, 2018 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .