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 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); }
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); }
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()); }