void set(DMassC m) { _mass = m.getMass(); _c = new DVector3(m.getC()); _I = new DMatrix3(m.getI()); }
void set(DMassC m) { _mass = m.getMass(); _c = new DVector3(m.getC()); _I = new DMatrix3(m.getI()); }
public void dMassAdd (DMassC b) { //dAASSERT (b); double denom = dRecip (_mass + b.getMass()); //for (i=0; i<3; i++) a._c.v[i] = (a._c.v[i]*a._mass + b._c.v[i]*b._mass)*denom; _c.eqSum( _c, _mass, b.getC(), b.getMass() ).scale( denom ); _mass += b.getMass(); //for (i=0; i<12; i++) a._I.v[i] += b._I.v[i]; _I.add(b.getI()); }
public void dMassAdd (DMassC b) { //dAASSERT (b); double denom = dRecip (_mass + b.getMass()); //for (i=0; i<3; i++) a._c.v[i] = (a._c.v[i]*a._mass + b._c.v[i]*b._mass)*denom; _c.eqSum( _c, _mass, b.getC(), b.getMass() ).scale( denom ); _mass += b.getMass(); //for (i=0; i<12; i++) a._I.v[i] += b._I.v[i]; _I.add(b.getI()); }
/** * Get the mass of a body. * @param b b * @param mass mass * */ //ODE_API // void dBodyGetMass (dBody b, dMass *mass){ public static void dBodyGetMass (DBody b, DMass mass){ mass.setI(b.getMass().getI()); mass.setC(b.getMass().getC()); mass.setMass(b.getMass().getMass()); }
/** * Get the mass of a body. * @param b b * @param mass mass * */ //ODE_API // void dBodyGetMass (dBody b, dMass *mass){ public static void dBodyGetMass (DBody b, DMass mass){ mass.setI(b.getMass().getI()); mass.setC(b.getMass().getC()); mass.setMass(b.getMass().getMass()); }
/** * This is the explicit computation of * gyroscopic forces. */ private static void expStep(DBody body) { // Explicit computation DMatrix3 I = new DMatrix3(), tmp = new DMatrix3(); DMassC m = body.getMass(); DMatrix3C R = body.getRotation(); // compute inertia tensor in global frame OdeMath.dMultiply2_333 (tmp,m.getI(),R); OdeMath.dMultiply0_333 (I,R,tmp); // compute explicit rotational force // we treat 'tmp'like a vector, but that's okay. DVector3C w = body.getAngularVel(); OdeMath.dMultiply0_331 (tmp,I,w); DVector3 tau = new DVector3(); DVector3 tmp2 = new DVector3(tmp.get00(), tmp.get01(), tmp.get02()); OdeMath.dCalcVectorCross3(tau,tmp2,w); body.addTorque(tau); }