skeptical scientist wrote:
quintopia wrote:I think you got it wrong. What everyone else said is that the n-dimensional equivalent of an axis is whichever (n-2)-dimensional subspace which is fixed. 2 dimensions is not enough.
SO, how do I convert this into an algorithm I can actually implement? Here's my best guess based on what has been said so far:
-Find an orthonormal basis for span(x,y) (Which is just [x,(y-<x,y>x)/|y-<x,y>x|] since x is already unit length)
-Find an orthonormal basis for Rn with the basis for span(x,y) as its first two components (complete it using null([x,y]T)). Represent this basis as a matrix B.
-Find the angle theta between x and y (cos-1<x,y>)
-Replace the upper left corner of the identity matrix by the 2-D rotation matrix for angle theta ([cos theta, -sin theta; sin theta, cos theta]). Call this matrix R.
-The final rotation matrix is BRB-1.
Do I have this algorithm correct?
I think that will work. I'm not quite sure what you mean by null([x,y]T
), or how you use it to complete your basis which started with [x,(y-<x,y>x)/|y-<x,y>x|], (I would just have used Gram-Schmidt on (x,y,e1
), and thrown out the two 0 vectors which resulted, in order to get a basis) but assuming that part works, everything else will work.
Hi, i found this thread because i was googling for how to rotate something in n dimensions (really hard to find, strangely.. i guess because a) nobody cares about higher dimensions in proportion to how many people are writing computer games, and b) rotation is ill-defined in higher d's), figures i'd find the answer on xkcd.
but i don't understand any of this math. can somebody put this into a straightforward algorithm for me?
for example, i have no idea what <x,y> means or what span(x,y) does. (matrix multiplication, sine and cosine i can do.)
also, i was wondering.. i'm getting the idea that for any two vectors, in higher there's an unlimited number of ways to rotate between them. the idea of taking the 'shortest path' is probably good, but i'd also like to know how to parameterize the remaining degrees of freedom (without resorting to gram-schmidt or null([x,y]T
) (what the hell does that even mean? what is T? and what is a null space? etc.) and then how to do the calculations based on them.
i also heard that in higher dimensions there's enough "room" for things to rotate at two different speeds at once. it went something like this:
[cos theta, sin theta, 0 0
-sin theta, cos theta, 0, 0
0, 0, cos theta, sin theta
0, 0, -sin theta, cos theta]
or something like that. i don't remember exactly and i can't find the website again.
the question is.. are such rotations distorted rotations? would it be a purer rotation, in some sense, to not rotate at two different speeds? or is it just another necessary degree of freedom that shouldn't be selectively ignored?
mainly though, of course, the question is, how to do all of this in plain algebraic/trigonometric terms.