[ODE] Approximate Hydrodynamic Forces

David Whittaker david at csworkbench.com
Fri Apr 18 09:06:01 2003


Great work!  I should have thought about that :(  I just thought I knew
for sure that OpenGL stored it's axes in columns, and ODE was backwards. 
Now we just need to come up with similar functions for all the built-in
types and we'll be set.

David

> Hi David,
>
> I think I have cracked it!!! : )
>
> void ApplyHydrodynamicForces(dReal viscosity)
> {
>    const dReal *lvel = dBodyGetLinearVel(body);
>    const dReal *R = dBodyGetRotation(body);
>    dReal ss[3];
>    dGeomBoxGetLengths(geom, ss);
>
>    dReal AreaX = ss[1]*ss[2];
>    dReal AreaY = ss[0]*ss[2];
>    dReal AreaZ = ss[0]*ss[1];
>
>    //In the end it was so simple. The rotation matrix is ordered
> differently.
>    dReal DotProdX = (R[0]*lvel[0] + R[4]*lvel[1] + R[8]*lvel[2]);
>    dReal DotProdY = (R[1]*lvel[0] + R[5]*lvel[1] + R[9]*lvel[2]);
>    dReal DotProdZ = (R[2]*lvel[0] + R[6]*lvel[1] + R[10]*lvel[2]);
>
>    dReal nx = DotProdX*AreaX;
>    dReal ny = DotProdY*AreaY;
>    dReal nz = DotProdZ*AreaZ;
>
>    //In the end it was so simple. The rotation matrix is ordered
> differently.
>    dReal temp = -nx*viscosity;
>    dBodyAddForce(body, temp*R[0], temp*R[4], temp*R[8]);
>
>    temp = -ny*viscosity;
>    dBodyAddForce(body, temp*R[1], temp*R[5], temp*R[9]);
>
>    temp =-nz*viscosity;
>    dBodyAddForce(body, temp*R[2], temp*R[6], temp*R[10]);
> }
>
> I have been banging my head off the screen trying to work this out!!
>
> I am a happy man now : )
>
> Of course I would not have even got close if you had not helped me out
> in  the first instance, thanks David.
>
> Cheers,
>
> Ander
>
> _________________________________________________________________
> Hotmail now available on Australian mobile phones. Go to
> http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode