/** * Check if a mass structure has valid value. * The function check if the mass and inertia matrix are positive definits * * @param m A mass structure to check * * @return 1 if both condition are met */ //ODE_API public static boolean dMassCheck(DMassC m) { return m.check(); }
public void dBodySetMass (DMassC mass2) { //dAASSERT (mass2 ); dIASSERT(mass2.check()); // The centre of mass must be at the origin. // Use dMassTranslate( mass, -mass->c[0], -mass->c[1], -mass->c[2] ) // to correct it. DVector3C mass2c = mass2.getC(); dUASSERT( Math.abs( mass2c.get0() ) <= DBL_EPSILON && Math.abs( mass2c.get1() ) <= DBL_EPSILON && Math.abs( mass2c.get2() ) <= DBL_EPSILON, "The centre of mass must be at the origin." ); //memcpy (b.mass,mass,sizeof(dMass)); mass.set(mass2); if (!dInvertPDMatrix (mass._I, invI)) { dDEBUGMSG ("inertia must be positive definite!"); invI.setIdentity(); } invMass = dRecip(mass._mass); }
System.out.println("Object G=" + GRAVITY*m.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); }
public void dBodySetMass (DMassC mass2) { //dAASSERT (mass2 ); dIASSERT(mass2.check()); // The centre of mass must be at the origin. // Use dMassTranslate( mass, -mass->c[0], -mass->c[1], -mass->c[2] ) // to correct it. DVector3C mass2c = mass2.getC(); dUASSERT( Math.abs( mass2c.get0() ) <= DBL_EPSILON && Math.abs( mass2c.get1() ) <= DBL_EPSILON && Math.abs( mass2c.get2() ) <= DBL_EPSILON, "The centre of mass must be at the origin." ); //memcpy (b.mass,mass,sizeof(dMass)); mass.set(mass2); if (!dInvertPDMatrix (mass._I, invI)) { dDEBUGMSG ("inertia must be positive definite!"); invI.setIdentity(); } invMass = dRecip(mass._mass); }
private void adjustMass(DRagdollConfig skeleton) { for (DxRagdollBody bone : bones) { DMass mass = ((DMass)bone.getBody().getMass()); mass.adjust(bone.getBody().getMass().getMass() * skeleton.getMass() / totalMass); bone.getBody().setMass(mass); } }
private void adjustMass(DRagdollConfig skeleton) { for (DxRagdollBody bone : bones) { DMass mass = ((DMass)bone.getBody().getMass()); mass.adjust(bone.getBody().getMass().getMass() * skeleton.getMass() / totalMass); bone.getBody().setMass(mass); } }
/** * Check if a mass structure has valid value. * The function check if the mass and inertia matrix are positive definits * * @param m A mass structure to check * * @return 1 if both condition are met */ //ODE_API public static boolean dMassCheck(DMassC m) { return m.check(); }
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()); }