/** * Return a new dVector containing the specified column. * For padding=4 this uses the elements c, 4+c, 8+c; * @param c Column (0, 1, 2) * @return A new dVector. */ @Override public DVector3 columnAsNewVector(int c) { // return new dVector3(get(0, c), get(1, c), get(2, c)); return new DVector3(v[c], v[c + MAX_J], v[c + 2*MAX_J]); }
@Override public void getInfo2( double worldFPS, double worldERP, Info2Descr info ) { int row = 0; DVector3[] ax = new DVector3[]{new DVector3(), new DVector3(), new DVector3()}; computeGlobalAxes( ax ); for ( int i = 0;i < num;i++ ) { row += limot[i].addLimot( this, worldFPS, info, row, ax[i], false ); } }
public void dJointSetPRAnchor( double x, double y, double z ) { dJointSetPRAnchor( new DVector3(x, y, z) ); } public void dJointSetPRAnchor( DVector3C xyz )
public void dJointSetUniversalAnchor( double x, double y, double z ) { dJointSetUniversalAnchor( new DVector3(x, y, z) ); } public void dJointSetUniversalAnchor( DVector3C xyz )
/** * Set the joint anchor. * @param j j * @param x x * @param y y * @param z z */ //ODE_API public static void dJointSetPistonAnchor (DPistonJoint j, double x, double y, double z) { j.setAnchor(new DVector3(x, y, z)); }
@Override void setRelativeValues() { DVector3 anchor = new DVector3(); dJointGetBallAnchor(anchor); setAnchors( anchor, anchor1, anchor2 ); }
public DxMass() { super(); _c = new DVector3(); _I = new DMatrix3(); dMassSetZero (); }
void set(DMassC m) { _mass = m.getMass(); _c = new DVector3(m.getC()); _I = new DMatrix3(m.getI()); }
private DVector3 getDragTorque(double density, DBody odeBody, double area) { DVector3 dragTorque = new DVector3(odeBody.getAngularVel()); double avel = dragTorque.length(); dragTorque.safeNormalize(); dragTorque.scale(-0.5 * density * area * avel * avel * 0.5); return dragTorque; }
public DxRagdollBody(DBody body, double length, double radius, DVector3C pinitial, DQuaternionC qinitial) { this.body = body; this.length = length; this.radius = radius; this.position = new DVector3(pinitial); this.quaternion = new DQuaternion(qinitial.get0(), qinitial.get1(), qinitial.get2(), qinitial.get3()); }
@Override void setRelativeValues() { DVector3 vec = new DVector3(); dJointGetPistonAnchor(vec); setAnchors( vec, anchor1, anchor2 ); dJointGetPistonAxis(vec); setAxes( vec, axis1, axis2 ); computeInitialRelativeRotation(); }
/** * Return a new vector v0 = v(this) - v2. * @param v2 v2 * @return new vector */ @Override public final DVector3 reSub(DVector3C v2) { return new DVector3( get0() - v2.get0(), get1() - v2.get1(), get2() - v2.get2()); }
void dGeomSetOffsetWorldPosition (double x, double y, double z) { dUASSERT (_gflags & GEOM_PLACEABLE,"geom must be placeable"); dUASSERT (body, "geom must be on a body"); DxSpace.CHECK_NOT_LOCKED (parent_space); if (offset_posr == null) { dGeomCreateOffset(); } body.dBodyGetPosRelPoint(new DVector3(x, y, z), offset_posr.pos); dGeomMoved(); }
void dBodyAddRelForceAtPos (DVector3C frel, DVector3C p) { DVector3 f = new DVector3(); dMultiply0_331 (f,_posr.R(),frel); facc.add(f); DVector3 q = p.reSub(_posr.pos()); dAddVectorCross3 (tacc,q,f); }
@Override void setRelativeValues() { DVector3 vec = new DVector3(); dJointGetHingeAnchor(vec); setAnchors( vec, anchor1, anchor2 ); dJointGetHingeAxis(vec); setAxes( vec.get0(), vec.get1(), vec.get2(), _axis1, _axis2 ); computeInitialRelativeRotation(); }
private void addSpringForce (double ks) { DVector3C p1 = body[0].getPosition(); DVector3C p2 = body[1].getPosition(); DVector3 tmp = new DVector3(); //dBodyAddForce (body[0],ks*(p2.v[0]-p1.v[0]),ks*(p2.v[1]-p1.v[1]),ks*(p2.v[2]-p1.v[2])); tmp.eqDiff(p2, p1).scale(ks); body[0].addForce(tmp); //dBodyAddForce (body[1],ks*(p1.v[0]-p2.v[0]),ks*(p1.v[1]-p2.v[1]),ks*(p1.v[2]-p2.v[2])); tmp.eqDiff(p1, p2).scale(ks); body[1].addForce(tmp); }
void getBodyPosr(final DxPosR offset_posr, final DxPosR final_posr, DxPosR body_posr) { DMatrix3 inv_offset = new DMatrix3(); matrixInvert(offset_posr.Rw(), inv_offset); dMultiply0_333(body_posr.Rw(), final_posr.R(), inv_offset); DVector3 world_offset = new DVector3(); //TZ dMultiply0_331(world_offset, body_posr.R(), offset_posr.pos()); // body_posr.pos.v[0] = final_posr.pos.v[0] - world_offset.v[0]; // body_posr.pos.v[1] = final_posr.pos.v[1] - world_offset.v[1]; // body_posr.pos.v[2] = final_posr.pos.v[2] - world_offset.v[2]; body_posr.pos.eqDiff( final_posr.pos(), world_offset ); }