Integrating a quaternion

Started by
4 comments, last by Dirk Gregorius 1 year, 2 months ago

One of those standard questions, and I've solved this before, but can't find the answer right now.

Given:

  • omega: Angular velocity as a vector (direction is the axis, length is the speed in radians/sec),
  • q0: Original orientation, as a normalized quaternion
  • t: time, a scalar

Compute the new orientation, as a normalized quaternion, after rotating at angular velocity omega for time t.

let q1 = integrate_quaternion(q0, omega, t); // Rust syntax

Despite this being a common operation, the common vector libraries don't have it.

Theory: https://arxiv.org/pdf/1604.08139.pdf

Advertisement

First google result doesn't help?

This is used commonly in physics engines

https://www.cs.cmu.edu/~spiff/moedit99/expmap.pdf

Dirk Gregorius said:
This is used commonly in physics engines https://www.cs.cmu.edu/~spiff/moedit99/expmap.pdf

Given that the idea of raising a scalar base to a non-scalar power is at best tenuously intuitive, why do we use the term exponential map? Historically, the formulation of the map as an infinite series has the same form as the series expansion of the exponential ex for real numbers x, and thus the mathematical community has adopted the name exponential for the map.

I guess this answers my long standing question of why i have to use pow(x,2) to double the angle of a complex number.

Unfortunately i do not really understand the answer. \:D/

Nagle said:
One of those standard questions, and I've solved this before, but can't find the answer right now.

I have this tooling function in my code, if it helps:

inline sQuat IntegrateAngVel (const sQuat &orn, const sVec3 &angVel, const float timestep)
{
	float sql = angVel.SqL(); // squared magnitude

	if (sql > FP_EPSILON2) 
	{
		float invOmegaMag = 1.0f / sqrt(sql);
		sVec3 omegaAxis (angVel * invOmegaMag);
		float omegaAngle = invOmegaMag * sql * timestep;
		sQuat rotation; rotation.FromAxisAndAngle (omegaAxis, omegaAngle);
		sQuat newOrn = rotation * orn;
		newOrn.Normalize ();
		return newOrn;
	}
	return orn;
}

But this sure can be optimized, and more important: There should be a way to integrate tiny velocity as well, at least using some approximation.
So my code is not good for something serious.

Edit:

There should be a way to integrate tiny velocity as well, at least using some approximation.

Continuing with the paper, it has explained just that next.
I now remember to have seen this in code in the Bullet engine.

Given that the idea of raising a scalar base to a non-scalar power is at best tenuously intuitive, why do we use the term exponential map? Historically, the formulation of the map as an infinite series has the same form as the series expansion of the exponential ex for real numbers x, and thus the mathematical community has adopted the name exponential for the map.

Not exactly the same, but similar idea. It is not that unintuitive.

This topic is closed to new replies.

Advertisement