Rotate 1 plane in 3d space to be parallel to another

In summary, the conversation is about trying to rotate shape A so that a given face is parallel to the nearest face of shape B. The issue is that the program keeps alternating between 4 rotations or only being able to get the same face to rotate towards. The problem is not knowing what information is needed to perform the rotation, such as the quaternions for each shape and their orientation with respect to a reference direction. The solution involves finding the angle between the two normal vectors and using the cross product to build a quaternion that transforms one vector to the other.
  • #1
sparkzbarca
7
0
I'm not sure if this is the right forum.

I'm actually trying to solve this for a computer program

given shape A and shape B i'd like to rotate shape A so a given face is parallel to the nearest face of shape B

http://postimage.org/image/shb6kyv6d/

attached image but i can't see it. the link
http://postimage.org/image/shb6kyv6d/

i've honestly been working on this problem for hours.
When I run the program The issue i have is it keep keeps alternating between 4 rotations or I can only get the same face everytime to rotate towards it like.
cross Shape A's right with shape B's normal and it produces a plane perpindicular to shape B's plane but the same side of shape A always faces it, not just the nearest.

If i try and change it I sometimes end up with the shape shifting between 4 different rotations.
Presumably the 4 quadrants I think because I'm giving it euler angles and they can represent one of 4 valid rotations but I've no idea how to convert that angle into a single quaternion rotation.

I have the quaternion of each shape but I don't understand quaternions or how to change them properly.

Any help would be much appreciated on what the general function should look like.
I think part of the problem is not knowing what information exactly i need to perform the rotation.
 
Physics news on Phys.org
  • #2
The quaternion of each shape? The quaternions describing their orientation with respect to a reference direction?

You know the two normal vectors, so this is not a difficult computation. You can find the angle between the vectors by either the dot or cross product.

Find the unit vector result of the cross product, and this is the "imaginary" that you use to build the quaternion.

That is to say, if your normal vectors are [itex]a,b[/itex], then the quaternion that transforms [itex]a[/itex] to [itex]b[/itex] is

[tex]q = \cos \frac{\theta}{2} + \frac{a \times b}{|a \times b|} \sin \frac{\theta}{2}[/tex]

where [itex]\sin \theta = \frac{a \times b}{|a||b|}[/itex].
 

1. How do you calculate the angle of rotation needed to align one plane with another?

The angle of rotation can be calculated using the dot product between the normal vectors of the two planes. The dot product represents the cosine of the angle between the two vectors, so by taking the inverse cosine of the dot product, you can determine the angle of rotation.

2. What is the difference between a rotation matrix and a quaternion?

A rotation matrix is a 3x3 matrix used to represent rotations in 3D space, while a quaternion is a mathematical representation of a 3D rotation using four numbers. Quaternions are often used in computer graphics and animation because they are more efficient for interpolating between rotations.

3. Can you rotate a plane in 3D space without changing its size or shape?

Yes, you can rotate a plane without changing its size or shape by using an orthogonal rotation matrix. This type of rotation preserves the distances and angles between points on the plane, ensuring that its size and shape remain unchanged.

4. Is it possible to rotate a plane in 3D space to be parallel to another plane without changing its orientation?

No, it is not possible to rotate a plane to be parallel to another plane without changing its orientation. This is because parallel planes must have the same orientation, meaning that they must be facing the same direction.

5. What is the purpose of rotating one plane to be parallel to another in 3D space?

The purpose of rotating one plane to be parallel to another is to align the two planes in a way that simplifies calculations or makes it easier to work with the geometry of the situation. For example, in engineering or architecture, it may be necessary to align two planes in order to accurately measure distances or angles between them.

Similar threads

Replies
2
Views
3K
  • Differential Geometry
Replies
3
Views
1K
Replies
8
Views
618
  • General Math
2
Replies
45
Views
3K
  • DIY Projects
Replies
19
Views
600
  • Sci-Fi Writing and World Building
Replies
1
Views
534
Replies
6
Views
1K
  • Differential Geometry
Replies
1
Views
1K
Replies
1
Views
1K
Replies
1
Views
3K
Back
Top