I'm not sure if this is the right forum.(adsbygoogle = window.adsbygoogle || []).push({});

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 cant 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 dont 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 Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

**Physics Forums | Science Articles, Homework Help, Discussion**