question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quaternion transform method only works with normalized quaternions

See original GitHub issue

The Quaternion method transform requires the quaternion to be normalized, but this is not documented.

There is a better method here, which works with unnormalized quaternions, but also avoids the sqrt (see the Java code):

https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
httpdigestcommented, Jan 7, 2020

A new 1.9.21-SNAPSHOT build is up on oss.sonatype.org with a Quaternion.transformUnit() (which works like the old Quaternion.transform()) and a modified Quaternion.transform() which works with non-unit quaternions as well.

0reactions
httpdigestcommented, Jan 7, 2020

The only problem with adding a properties field is that it would increase the storage size required

Unlikely. Object sizes are padded for 8-byte alignment anyways. Currently, on a JDK-14, a Quaternionf instance takes 32 bytes and a padding of 4 bytes (according to JOL). Adding an additional byte makes no difference to the size.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quaternion and normalization - Stack Overflow
Normalization is a kludge to drag the quaternion back to the unit 3-sphere. The reason quaternions drift off the manifold is because that...
Read more >
Maths -Quaternion Transforms - Martin Baker - EuclideanSpace
First we convert the 3D vector into a quaternion, to do this we set the imaginary parts of the quaternion to the x,y...
Read more >
Normalizing a quaternion - Mathematics Stack Exchange
I already know: The normalized quaternion is called unit quaternion and can be calculated in this way: Uq=q||q||.
Read more >
Quaternions and spatial rotation - Wikipedia
Quaternions give a simple way to encode this axis–angle representation in four numbers, and can be used to apply (calculate) the corresponding rotation...
Read more >
Quaternions∗ - Iowa State University
A quaternion is a 4-tuple, which is a more concise representation than a rotation matrix. Its geo- metric meaning is also more obvious...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found