ex2vec_fix

marxs.math.rotations.ex2vec_fix(e1, efix)[source] [edit on github]

Rotate x-axis to e1, use efix to break rotation ambiguity.

This function calculates the rotation matrix that rotates the x-axis to e1, i.e. it rotates the normal of the y,z-plane to a new plane where e1 is the normal. This still leaves the rotation angle of the plane free. This function breaks the degeneracy by keeping a vector that is coplanar with the normal and fix coplanar with fix and the new normal.

The purpose of this function is best explained by an example: Imagine a plane in the y, z plane. We want to rotate the plane, such that e1 will be a new normal of the plane. However, since the orientation of the plane is not fixed, there is an infinite number of ways to do this. This ambiguity can be broken if we additionally require that the rotated \(\hat e_y\) will be coplanar with fix.

Inspired by the algorithm described in: https://www.fastgraph.com/makegames/3drotation/

Parameters:
e1np.array of shape (3, )

new normal of plane

efixnp.array of shape (3, )

Vector to break rotational ambiguity.

Returns:
rotnp.array of shape (3, 3)

Rotation matrix