# Homework Help: Align two Arbitrary 2D vectors

1. Apr 21, 2007

### Peter5897

I've got a computer graphics final coming up and for some reason my brain is crapping out when it comes to, what should be, a simple problem.

I know how to align two arbitrary 3D vectors (axis-angle) but 2D in 2D I'm having trouble remembering how to do it.

On my review sheet it states

1. The problem statement, all variables and given/known data

In 2D, computer the 3x3 matrix that aligns V = (Vx, Vy) with W = (Wx, Wy)

2. Relevant equations

I suppose the rotation matrix would be a start.

----------------------------
| cos(theta) -sin(theta) 0 |
| sin(theta) cos(theta) 0 |
| 0 0 1 |
---------------------------

3. The attempt at a solution

I know that theta = arccos(v dot w) but I believe that on a test shoving in an arccos won't be sufficient. IE

--------------------------------------------------
| cos(arccos(v dot w)) -sin(arccos(v dot w)) 0 |
| sin(arccos(v dot w)) cos(arccos(v dot w)) 0 |
| 0 0 1 |
---------------------------------------------------

Pretty gross looking if you ask me.

My question to you is, what am I forgetting? I believe there must be some simple linear algebra theorem that I am currently drawing a blank on, or is this really the best way?

Thanks for any insight you guys could bring,
-Peter

PS, sorry for my awful attempt at making matrices, the formatting seems to change during the submission process.

PPS, probably should have put this in the pre-calc section... whoops.

Last edited: Apr 21, 2007