gl-matrix icon indicating copy to clipboard operation
gl-matrix copied to clipboard

Optimized quaternion rotation routine

Open infusion opened this issue 1 year ago • 1 comments

Hello,

I'm the author of Quaternion.js and derived a simpler method to rotate a vector using normalized quaternions, reducing the number of multiplications quite a bit. Since gl-matrix is developed with performance in mind, I think this addition can improve quite a few code bases.

All your unit tests are passing. I removed the performance test link, since jsPerf is offline for quite some time now.

Robert

infusion avatar Oct 11 '24 12:10 infusion

This looks like an excellent improvement. I wish it would be merged. My only nit is that adding two floats to implement multiplication by two is probably not worthwhile and possibly slower, since the upshot is a simple increment of the exponent. At any rate, JIT compilation will do the right thing if the code ends up in a critical place.

gene-ressler avatar Apr 17 '25 19:04 gene-ressler

Thank you for the contribution, and sorry it took a while to merge!

toji avatar Aug 08 '25 17:08 toji