Archived

This topic is now archived and is closed to further replies.

rotation integration approximation 2nd order

This topic is 5154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all! What do you think about this approximation ? Can it be much usefull ? This series can be easy and fast interpolated and in the higer order. Many people use the 1st order approximation.
 
/**
  angular kinematik integration approximated by second order taylor series
  delta_orientation( unit_axis*sin(0.5*delta_angle), cos(0.5*delta_angle) )
  where the unit_axis - axis of rotation, delta_orientation - quaternion
  let's divide the delta_orientation by "cos(0.5*delta_angle)" , we get 
  delta_orientation( unit_axis*tan( 0.5*delta_angle ), 1.0 )
  and use the tailor series for approximation

  sin(x) = x - x3/3! + x5/5! - ... 
  cos(x) = 1 - x2/2! + x4/4! - ... 
  tan(x) = x + x^3/3 + 2x^5/15 + 17x^7/315 + ...   
  tan(x)-> x + x^3/3 -> second order serie

  angular_velocity = unit_axis * l ; (  angular_velocity - 3d vector, l - length of angular_velocity)

  unit_axis*( ha + ha*ha*ha/3 )  ; ( ha - half angle )
  ha = l*dt*0.5                  ; ( dt - deltatime )
  unit_axis*( l*dt*0.5 + l*l*l*dt*dt*dt*0.5*0.5*0.5/3 ) = 
  unit_axis*l*( dt*0.5 + l*l*dt*dt*dt*0.5*0.5*0.5/3 ) = 
  unit_axis*l*( dt*0.5*(1 + l*l*dt*dt*0.5*0.5/3) ) = 
  angular_velocity*( dt*0.5*(1 + angular_velocity.len_squared()*dt*dt*0.5*0.5/3) );
*/

static const double TTS_M = 0.5*0.5*0.5/3.0;
void integrate_rotation_appx2( const vector3& angular_velocity, const float& delta_time,
                               xxquaternion& orientation )
{
    float ls = angular_velocity.len_squared();
    //float hdt = delta_time*0.5f;

    //float av_multer = hdt*(1.0f + ls*hdt*hdt/3.0f);

    float av_multer = delta_time*(0.5f + ls*delta_time*delta_time*(float)TTS_M);
    xxquaternion delta_orientation( angular_velocity.x*av_multer, 
                                    angular_velocity.y*av_multer,
                                    angular_velocity.z*av_multer,
                                    1.0f );
    orientation = delta_orientation*orientation;
}
[edited by - minorlogic on November 7, 2003 7:28:28 AM]

Share this post


Link to post
Share on other sites
my little tests

delta_angle = 0.26179939424699705; // 15 degrees
error 1st order = 0.0014801013291726318;
error 2nd order = 1.0135282684622376e-005;
//--------------------------------------------
delta_angle = 0.52359881880432080; // 30 degrees
error 1st order = 0.011493226984910957;
error 2nd order = 0.00031474232904990014;
//--------------------------------------------
delta_angle = 0.78539819188978499; // 45 degrees
error 1st order = 0.037004700180601237;//4.711%
error 2nd order = 0.0022682186751064376;//0.288%
//--------------------------------------------
delta_angle = 1.5707962915884581; // 90 degrees
error 1st order = 0.23924877892111976;//15.231% !!!!
error 2nd order = 0.054546085807590322;//3.472%


Share this post


Link to post
Share on other sites