Align 3d object to vector by rotation

  • Context: Undergrad 
  • Thread starter Thread starter jschieck
  • Start date Start date
  • Tags Tags
    3d Rotation Vector
Click For Summary
SUMMARY

This discussion focuses on aligning a 3D object to a normal vector of a polygon face through rotation using linear algebra techniques. The user has a normal vector and an up vector of (0,1,0) but struggles with achieving the correct rotation using the CrossProduct function. The solution involves normalizing the vectors, constructing orthonormal bases, and utilizing matrix operations to derive the rotation matrix that aligns the two vectors.

PREREQUISITES
  • Understanding of 3D vector mathematics
  • Familiarity with the Gram-Schmidt process for orthonormalization
  • Knowledge of matrix operations and determinants
  • Experience with programming functions for vector normalization and cross products
NEXT STEPS
  • Implement the Gram-Schmidt process for orthonormalization in your preferred programming language
  • Study matrix determinant properties and their implications in 3D transformations
  • Learn about rotation matrices and their applications in computer graphics
  • Explore libraries or frameworks that facilitate 3D transformations, such as OpenGL or DirectX
USEFUL FOR

This discussion is beneficial for computer graphics developers, game developers, and anyone involved in 3D modeling or simulation who needs to understand vector alignment and rotation techniques.

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 independent 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 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K