How do you find the 4x4 matrix (translation & rotation) of two equal distance lines or vectors in space? For example, I have a fixed vector V1= (4,3,2). I have another vector V2=(-1,4,4). How would I calculate the 4x4 matrix to align V2 to V1? And how would I check to see if the 4x4 matrix is correct?
I can understand formulas and equations a lot better if there's an actual number problem. Unfortunately, there's not much information out there with number problems for me.
------------------------------------
I can find the formula for rotation about the x,y,and z axis.
1 0 0
0 cos(a) -sin(a) .......about x-axis...a=angle
0 sin(a) cos(a)
cos(a) 0 sin(a)
0 1 0 ........about y axis...a=angle
-sin(a) 0 cos(a)
cos(a) -sin(a) 0
sin(a) cos(a) 0 ......about z-axis...a=angle
0 0 1
But how do you find the angle (a)? This is how I did it, but not sure if it's right or not:
1)I calculated the length:
|v1|^2=(4,3,2)* (4,3,2) =29=v1unit
|v2|^2=(-1,4,4)* (-1,4,4)=33=v2unit
2) normalizing
(v1 * v2)/(√29√33)=0.51721
3) angle
Cos(x)=.51721 58.9 degrees
So would this 58.9 degree be used in place of all the (a) in the rotation formula?
-------------------------------
As for the translation, I'm not sure how to find it. Do I just subtract V2 by V1? Or do I subtract the unit vector of V2 and V1?
--------------------------------------
To combine both translation and rotation into 4x4 matrix, do I multiply the rotations together and just put in the subtraction result in the last column for translation?
---------------------------------------
If I’ve gotten a matrix, how would I check it to see if it’s right?
------------------------------------
I’m really confuse on this problem….please help! Thanks!
I can understand formulas and equations a lot better if there's an actual number problem. Unfortunately, there's not much information out there with number problems for me.
------------------------------------
I can find the formula for rotation about the x,y,and z axis.
1 0 0
0 cos(a) -sin(a) .......about x-axis...a=angle
0 sin(a) cos(a)
cos(a) 0 sin(a)
0 1 0 ........about y axis...a=angle
-sin(a) 0 cos(a)
cos(a) -sin(a) 0
sin(a) cos(a) 0 ......about z-axis...a=angle
0 0 1
But how do you find the angle (a)? This is how I did it, but not sure if it's right or not:
1)I calculated the length:
|v1|^2=(4,3,2)* (4,3,2) =29=v1unit
|v2|^2=(-1,4,4)* (-1,4,4)=33=v2unit
2) normalizing
(v1 * v2)/(√29√33)=0.51721
3) angle
Cos(x)=.51721 58.9 degrees
So would this 58.9 degree be used in place of all the (a) in the rotation formula?
-------------------------------
As for the translation, I'm not sure how to find it. Do I just subtract V2 by V1? Or do I subtract the unit vector of V2 and V1?
--------------------------------------
To combine both translation and rotation into 4x4 matrix, do I multiply the rotations together and just put in the subtraction result in the last column for translation?
---------------------------------------
If I’ve gotten a matrix, how would I check it to see if it’s right?
------------------------------------
I’m really confuse on this problem….please help! Thanks!