finding rotation matrix in 3d

suppose I have a normalized vector perpendicular to a plane like

$x = \frac{(2i+3j+k)}{\sqrt{14}}$ , how can I find a rotation matrix A, such that it rotates x into the xy plane like so:

$Ax = y = \frac{(i, j)} {\sqrt{2}}$

edit retag close merge delete

This is a linear algebra question, not a question about Sage. Try asking on http://math.stackexchange.com/

( 2012-06-19 13:29:31 +0100 )edit

Look at http://www.hr.shuttle.de:9000/home/pub/105/ There is an example.

( 2012-06-19 17:36:50 +0100 )edit

why did you rotate the vector around z axis? can't we rotate it around x and y axes instead?

( 2012-06-21 07:13:50 +0100 )edit

Your original question doesn't have a unique answer. There are infinitely many rotations that take your vector x to a vector in the XY-plane.

( 2012-06-21 12:20:36 +0100 )edit

Sort by » oldest newest most voted

According to documentation matrix.ith_to_zero_rotation return a rotation matrix that sends the i-th coordinates of the vector v to zero by doing a rotation with the (i-1)-th coordinate :

sage: v = vector((2,3,1))/sqrt(14)
sage: matrix.ith_to_zero_rotation(v, 2)
[                       1                        0                        0]
[                       0  3/10*sqrt(14)*sqrt(5/7)  1/10*sqrt(14)*sqrt(5/7)]
[                       0 -1/10*sqrt(14)*sqrt(5/7)  3/10*sqrt(14)*sqrt(5/7)]
sage: matrix.ith_to_zero_rotation(v, 2) * v
(1/7*sqrt(14), sqrt(5/7), 0)


See also matrix.vector_on_axis_rotation.

more