Align 3d object to vector by rotation

Click For Summary
To align a 3D object to a polygon face using rotation, the process involves normalizing the given vectors and constructing orthonormal bases for both the source and target vectors. The Gram-Schmidt process can be utilized to achieve this orthonormalization. After forming matrices from these bases, checking their determinants is crucial; if the determinant is -1, columns may need to be switched to maintain proper orientation. Finally, inverting the source matrix and multiplying it by the target matrix yields the rotation matrix needed to align the object correctly. This method provides a systematic approach to solving the rotation alignment problem.
jschieck
Messages
2
Reaction score
0
i have the normal vector of a polygon face, and an object i wish to align to it by rotating it on XYZ. my up vector is (0,1,0). been trying to figure it out by using CrossProduct but i never get the right results. I already have CrossProduct and Normalize functions so I don't need the math for that.

help?
 
Physics news on Phys.org
Basically, the mathematical problem you're asking about is: given two vectors v_1 and w_1 in R³, find a rotation that takes one to the other right?

Here is a way to do this. With a computer it should take only a few minutes.

1) normalize v_1 and complete to an orthonormal basis {v_1,v_2,v_3} (find v_2, v_3 linearly independant and use gram-schmidt process to orthonormalize)

2) normalize w_1 and complete to an orthonormal basis {w_1,w_2,w_3}

3) write down the matrix V whose column are the vectors v_i. Compute the determinant. If it is -1, switch columns 2 and 3.

4) write down the matrix W whose columns are the w_i. Compute the determinant. If it is -1, switch columns 2 and 3.

(These are the matrices that send the standard orthonormal basis e_1,e_2,e_3 to v_1,v_2,v_3 and w_1,w_2,w_3 respectively by a rotation.)

5) Invert the matrix V. Then WV^{-1} is a matrix that send the v_i to w_i by a rotation.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
8K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K