Skip to content

Quaternion multiplication fix#427

Open
JalenLv wants to merge 2 commits intomainfrom
quaternion_multiplication_fix
Open

Quaternion multiplication fix#427
JalenLv wants to merge 2 commits intomainfrom
quaternion_multiplication_fix

Conversation

@JalenLv
Copy link
Copy Markdown
Collaborator

@JalenLv JalenLv commented Nov 23, 2025

Note that multiplying two numpy.ndarrays uses the broadcasting rule. To get quaternion product, we should multiply two Ratations

>>> x1
array([0., 1., 2., 3.])
>>> x2
array([0., 1., 2., 3.])
>>> x1 * x2
array([0., 1., 4., 9.])
>>> (R.from_quat(x1) * R.from_quat(x2)).as_quat()
array([-7.15302691e-18,  4.28571429e-01,  8.57142857e-01,  2.85714286e-01])

R.from_euler() creates a Rotation but the old code has another .as_quat() which converts a Rotation back to ndarray.

Ref:

@JalenLv JalenLv added the bug Something isn't working label Nov 23, 2025
@JalenLv JalenLv requested a review from Isopod00 November 24, 2025 01:54
@JalenLv JalenLv self-assigned this Nov 24, 2025
@Isopod00 Isopod00 requested review from BergerKing333 and removed request for Isopod00 November 24, 2025 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant