Quaternions and angular velocity
I am writing a pool simulation game and wish to represent the orientation of my balls using quaternions. Unfortunately I have no idea how to add angular velocities to quaternions and my calculus is pretty poor. I would be most grateful if anyone could offer any advice regarding this subject. I am desperate.
if you represent Angular velocity as a AxisAngle ,
in code the Angle is a Len of vector and unit of vector is a rotation Axis
float AVLen = AngularVelocity.len();
float RotAngle = AVLen*DeltaTime;
float SinHRA = (float)sin( RA*0.5f );
float CosHRA = (float)cos( RA*0.5f );
float S = SinHRA/AVLen;
quaternion DeltaOrientation( AngularVelocity.x*S,
AngularVelocity.y*S,
AngularVelocity.z*S,
CosHRA );
Orientation = DeltaOrientation*Orientation;
in code the Angle is a Len of vector and unit of vector is a rotation Axis
float AVLen = AngularVelocity.len();
float RotAngle = AVLen*DeltaTime;
float SinHRA = (float)sin( RA*0.5f );
float CosHRA = (float)cos( RA*0.5f );
float S = SinHRA/AVLen;
quaternion DeltaOrientation( AngularVelocity.x*S,
AngularVelocity.y*S,
AngularVelocity.z*S,
CosHRA );
Orientation = DeltaOrientation*Orientation;
Google "quaternion angular velocity" and you''ll find lots of relevant pages. This article on Gamasutra briefly mentions using quaternions with angular velocity, it''s where I got started a while ago.
Thanks,
Both replies are helpful.Though I would like to try and store the angular velocity as a quaternion too. The gamasutra article does mention it but I have no idea how to implement the formula provided to add an angular velocity quaternion to an orientation quaternion (my calculus is awful). Any further help would be most appreciated.
Both replies are helpful.Though I would like to try and store the angular velocity as a quaternion too. The gamasutra article does mention it but I have no idea how to implement the formula provided to add an angular velocity quaternion to an orientation quaternion (my calculus is awful). Any further help would be most appreciated.
Rememeber that quternion keep orientation , limited by 0 - 360.
But angular velocity can be more.....
But angular velocity can be more.....
Just use some kind of numerical integration, Euler integration if you want to keep it simple. The differential equation is:
dQ/dt = 0.5 * Q * omega
Omega is the angular velocity vector as a quaternion with 0 for the scalar component. Q is the current orientation. Using Euler integration the new orientation Q'' after a time dt is:
Q'' = Q + dQ*dt
Q'' = Q + 0.5 * Q * omega * dt
So do Q * omega as a quaternion multiplication, then do a scalar multiplication of 0.5 * dt. To add that to the current orientation Q just add the individual components, scalar + scalar and vector + vector.
You may have to normalize Q'', I forget, it''s just done like 4d vector normalization.
dQ/dt = 0.5 * Q * omega
Omega is the angular velocity vector as a quaternion with 0 for the scalar component. Q is the current orientation. Using Euler integration the new orientation Q'' after a time dt is:
Q'' = Q + dQ*dt
Q'' = Q + 0.5 * Q * omega * dt
So do Q * omega as a quaternion multiplication, then do a scalar multiplication of 0.5 * dt. To add that to the current orientation Q just add the individual components, scalar + scalar and vector + vector.
You may have to normalize Q'', I forget, it''s just done like 4d vector normalization.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement