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.

Method to compute (q^-1 p) or (q p^-1) directly

See original GitHub issue

I’m looking for a method to compute the following for quaternions p and q:

r = p q p^-1

The combinations q p^-1 and q^-1 p seem to come up quite commonly (for the rotation between two quaternions), so it would increase efficiency if there were methods that computed these directly. (This would increase the number of multiplication methods by a factor of 3 over the current mul and premul variants – with new variants for inverting this and inverting the passed parameter.)

The JOML API lets you pre-allocate objects to avoid allocating intermediate objects, but then to compute a product with an inverted parameter, you have to pre-allocate a quaternion just to do the inversion (or deal with there being an extra intermediate object allocated). In the worst case, it is the following (I’m sure one or two of the intermediate objects could be reused with some smarter ordering of operations):

Quaterniond r = p.mul(q.mul(p.invert(new Quaterniond()), new Quaterniond()), new Quaterniond());

instead of something like

Quaterniond r = p.mul(q.mulByInverted(p, new Quaterniond()), new Quaterniond());

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
httpdigestcommented, Nov 10, 2019

Changes will be up with build https://travis-ci.org/JOML-CI/JOML/builds/609934214 on oss.sonatype.org Maven repo as a new 1.9.20-SNAPSHOT version.

1reaction
httpdigestcommented, Nov 10, 2019

I see, you need the “conjugate p by q” operation: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#The_conjugation_operation I’ll add it to JOML shortly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PRICE ELASTICITY OF DEMAND
If the percentage change is not given in a problem, it can be computed using the following formula: Percentage change in Qd =...
Read more >
Price Elasticity of Supply | Microeconomics - Lumen Learning
The point approach computes the percentage change in quantity supplied by dividing the change in quantity supplied by the initial quantity, and the...
Read more >
Price Elasticity of Demand Formula | Calculation and Examples
Price Elasticity of Demand can be determined in the following four steps: Identify P0 and Q0, which are the initial price and quantity...
Read more >
Quartiles, Deciles, & Percentiles With Cumulative Relative ...
This data and statistics video tutorial provides a basic introduction into quartiles, deciles, and percentiles. It explains how to find the ...
Read more >
How to calculate point price elasticity of demand - YouTube
This video goes over the method of calculating point price elasticity of demand and gives a few examples. Point price elasticity works by ......
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