Add .pow(exponent) and .multiplyByExponentiatedQuaternion(quat2, exponent) methods to the Quaternion class
See original GitHub issueIs your feature request related to a problem? Please describe.
Hello!
I want to be able to handle rotations in my engine in similar way to the positions - I can write position.addScaledVector(velocity, timePassed)
if I want to program moving with some velocity frame-by-frame and I want to be able to do similar thing for quaternions (or at least thing similar to position.add(velocity.clone().scale(timePassed))
), i.e. rotation.multiplyByExponentiatedQuaternion(rotationalVelocity, timePassed)
(or rotation.multiply(rotationalVelocity.clone().pow(timePassed))
).
Describe the solution you’d like
I suggest that methods .pow(exponent)
and .multiplyByExponentiatedQuaternion(quat2, exponent)
would be added to the Quaternion class.
Describe alternatives you’ve considered
These methods could be added just by monkey-patching the prototype of the Quaternion class (and it is how I do it currently).
Additional context
The methods could be implemented similar to glMatrix’s pow(out, a, b)
function: https://github.com/toji/gl-matrix/blob/master/src/quat.js#L280.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
@Mugen87 Conceptually,
quaternion.pow()
is the same asAdd
pow()
if you want, if it can be made efficient. I would not support adding the other method.see https://github.com/mrdoob/three.js/pull/22970#issuecomment-991583290