Align 3d object to vector by rotation

In summary, the conversation is about finding a rotation to align an object to a polygon face using a given normal vector and up vector. The solution involves normalizing the vectors and completing them to orthonormal bases, writing down matrices and computing determinants, and inverting one of the matrices to obtain the desired rotation.
  • #1
jschieck
2
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
  • #2
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.
 

1. How can I align a 3d object to a vector by rotation?

The process of aligning a 3d object to a vector by rotation involves using mathematical calculations to determine the necessary rotation angles and axes to align the object's orientation with the vector. This can be done by using tools such as rotation matrices or quaternions.

2. What is the purpose of aligning a 3d object to a vector by rotation?

The purpose of aligning a 3d object to a vector by rotation is to orient the object in a specific direction, making it easier to manipulate and interact with in a 3d space. This can be useful in various applications, such as computer graphics, animation, and robotics.

3. Can I use any vector to align a 3d object?

Yes, any vector can be used to align a 3d object. However, the chosen vector should be in the same coordinate system as the object and should have a unique direction to ensure accurate alignment.

4. Are there any limitations to aligning a 3d object to a vector by rotation?

One limitation of aligning a 3d object to a vector by rotation is that the object's shape and size may affect the accuracy of the alignment. Additionally, the object may have multiple possible orientations that align with the vector, so the desired orientation must be specified.

5. Are there any alternative methods for aligning a 3d object to a vector?

Yes, there are alternative methods for aligning a 3d object to a vector, such as using translation or scaling transformations. However, rotation is often the most efficient and accurate method for aligning an object to a specific direction or orientation.

Similar threads

Replies
40
Views
6K
Replies
2
Views
3K
  • Classical Physics
Replies
6
Views
600
Replies
10
Views
709
  • DIY Projects
Replies
4
Views
2K
Replies
13
Views
2K
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
Replies
17
Views
2K
  • Differential Geometry
Replies
6
Views
2K
Replies
1
Views
666
Back
Top