Skip to content

Rotation of a vector by a matrix and a quaternion are not equivalent #97

@mxrie-eve

Description

@mxrie-eve

To reproduce the bug:

m = matrix44.create_from_x_rotation(np.pi / 2.)
matrix44.apply_to_vector(m, [0., 1., 0., 1.])
# gives:
array([ 0.000000e+00, 0.000000e+00, -1.000000e+00,  1.000000e+00])

And

q = quaternion.create_from_x_rotation(np.pi / 2.)
quaternion.apply_to_vector(q, [0., 1., 0., 1.])
# gives:
array([0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.00000000e+00])

When you test the equivalence of the relation in test_m44_q_equivalence, you rotate a unit vector on the x-axis by the x-axis. The vector won't move as it is aligned with the axis of rotation...
The bug is visible when you check with unit vectors on the y-axis or z-axis, like above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions