[ODE] dxQuickStepper - fix

Patrick Enoch Hendrix_ at gmx.net
Wed May 9 15:48:07 MST 2007


hi,

this calculation appears to be true:

0*nan = nan

somehow my compilers (CodeWarrior / XCode gcc ) do not optimize that  
away (multiplication by zero).


since the clvel and cavel are not zeroed when POSITIONAL_CORRECTION  
is not defined, the quickstepper needs to be changed:


		// put v/h + invM*fe into tmp1
		for (i=0; i<nb; i++)
		{
			dReal body_invMass = body[i]->invMass;
			for (j=0; j<3; j++) tmp1[i*6+j] = body[i]->facc[j] * body_invMass +
                                               (body[i]->lvel[j] /* 
+0*body[i]->clvel[j]*/) * stepsize1;
			dMULTIPLY0_331 (tmp1 + i*6 + 3,invI + i*12,body[i]->tacc);
			for (j=0; j<3; j++) tmp1[i*6+3+j] += (body[i]->avel[j]/*+0*body[i]- 
 >cavel[j]*/) * stepsize1;
		}


... or bracket it with #ifdef's, or remove the multiplication  
completely.


patrick



More information about the ODE mailing list