[ODE] @@@ check computation of rotational force

Petr Sovis petr_sovis at hotmail.com
Thu Jun 12 03:19:01 2003


Hi,
in ODE step.cpp (line 326)

  // for all bodies, compute the inertia tensor and its inverse in the 
global
  // frame, and compute the rotational force and add it to the torque
  // accumulator.
  // @@@ check computation of rotational force.
  dReal *I = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
  dReal *invI = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
  dSetZero (I,3*nb*4);
  dSetZero (invI,3*nb*4);
  for (i=0; i<nb; i++) {
    dReal tmp[12];
    // compute inertia tensor in global frame
    dMULTIPLY2_333 (tmp,body[i]->mass.I,body[i]->R);
    dMULTIPLY0_333 (I+i*12,body[i]->R,tmp);
    // compute inverse inertia tensor in global frame
    dMULTIPLY2_333 (tmp,body[i]->invI,body[i]->R);
    dMULTIPLY0_333 (invI+i*12,body[i]->R,tmp);
    // compute rotational force
    dMULTIPLY0_331 (tmp,I+i*12,body[i]->avel);
    dCROSS (body[i]->tacc,-=,body[i]->avel,tmp);
  }

I don't understand last 2 lines - "computing rotational force" -
according to: (baraff lagrange multipliers solution && anitescu 
discretization )

     (J IM J^T) lambda = w + J (IM * Fext + vold / dtime)
     lambda >= 0 && w >= 0 && lambda * w = 0

should be Fext -> 2 * 3 * nobjects large vector of | f1 t1, f2 t2, .... |.
f1e = m * gravity_vector + linear_external_force
t1e = 0                                             - <<<<<<<<<<<<<<< that's 
my solution
t1e -= angvel x ((R Ibody R^T) angvel)  - <<<<<<<<<<<<<<< IN ODE in step.cpp

I thing "angvel x ((R Ibody R^T) angvel)"  is L(t) - angular momentum of the 
body - but i don't understand why - it may be external torque acting on 
body.

Anyone can explain me this computation ?
Thanks in advance
   Petr Sovis

P.S. @@@ check computation of rotational force. :)

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus