public DQuaternion(DQuaternion x) { this(); set(x); }
void dBodyCopyQuaternion (DxBody b, DQuaternion quat) { quat.set(b._q); }
public void setIdentity() { set(1, 0, 0, 0); } }
public DQuaternion(DQuaternion x) { this(); set(x); }
public DQuaternion(double x0, double x1, double x2, double x3) { this(); set(x0, x1, x2, x3); }
public final void setZero() { set(0, 0, 0, 0); }
public DQuaternion(double x0, double x1, double x2, double x3) { this(); set(x0, x1, x2, x3); }
public void setIdentity() { set(1, 0, 0, 0); } }
void dBodyCopyQuaternion (DxBody b, DQuaternion quat) { quat.set(b._q); }
/** * Copy the orientation of a body into a quaternion. * * @param body the body to query * @param quat a copy of the orientation quaternion * @see #dBodyGetQuaternion(DBody) */ //ODE_API public static void dBodyCopyQuaternion(DBody body, DQuaternion quat){ quat.set(body.getQuaternion()); }
/** * make a random vector with entries between +/- range. A has 4 elements. * @param A A * @param range range */ public static void dMakeRandomVector (DQuaternion A, double range) { for (int i=0; i<4; i++) A.set(i, (dRandReal()*2.0-1.0)*range ); } /**
/** * make a random vector with entries between +/- range. A has 4 elements. * @param A A * @param range range */ public static void dMakeRandomVector (DQuaternion A, double range) { for (int i=0; i<4; i++) A.set(i, (dRandReal()*2.0-1.0)*range ); } /**
/** * Copy the orientation of a body into a quaternion. * * @param body the body to query * @param quat a copy of the orientation quaternion * @see #dBodyGetQuaternion(DBody) */ //ODE_API public static void dBodyCopyQuaternion(DBody body, DQuaternion quat){ quat.set(body.getQuaternion()); }
void dGeomGetOffsetQuaternion (DQuaternion result) { if (offset_posr != null) { dQfromR(result, offset_posr.R()); } else { // dSetZero (result.v,4); // result.v[0] = 1; result.set(1, 0, 0, 0); } }
void dGeomGetOffsetQuaternion (DQuaternion result) { if (offset_posr != null) { dQfromR(result, offset_posr.R()); } else { // dSetZero (result.v,4); // result.v[0] = 1; result.set(1, 0, 0, 0); } }
public void dBodySetQuaternion (DQuaternionC q) { //dAASSERT (q); // _q.v[0] = q.v[0]; // _q.v[1] = q.v[1]; // _q.v[2] = q.v[2]; // _q.v[3] = q.v[3]; _q.set(q); dNormalize4 (_q); //dQtoR (b.q, b.posr.R); dRfromQ(_posr.Rw(), _q); // notify all attached geoms that this body has moved for (DxGeom geom2 = geom; geom2 != null; geom2 = geom2.dGeomGetBodyNext ()) geom2.dGeomMoved (); }
public void dBodySetQuaternion (DQuaternionC q) { //dAASSERT (q); // _q.v[0] = q.v[0]; // _q.v[1] = q.v[1]; // _q.v[2] = q.v[2]; // _q.v[3] = q.v[3]; _q.set(q); dNormalize4 (_q); //dQtoR (b.q, b.posr.R); dRfromQ(_posr.Rw(), _q); // notify all attached geoms that this body has moved for (DxGeom geom2 = geom; geom2 != null; geom2 = geom2.dGeomGetBodyNext ()) geom2.dGeomMoved (); }
public static void dDQfromW (DQuaternion dq, final DVector3C w, final DQuaternionC q) { //dAASSERT (w, q, dq); dq.set(0, 0.5*(- w.get0()*q.get1() - w.get1()*q.get2() - w.get2()*q.get3()) ); dq.set(1, 0.5*( w.get0()*q.get0() + w.get1()*q.get3() - w.get2()*q.get2()) ); dq.set(2, 0.5*(- w.get0()*q.get3() + w.get1()*q.get0() + w.get2()*q.get1()) ); dq.set(3, 0.5*( w.get0()*q.get2() - w.get1()*q.get1() + w.get2()*q.get0()) ); } }
public static void dDQfromW (DQuaternion dq, final DVector3C w, final DQuaternionC q) { //dAASSERT (w, q, dq); dq.set(0, 0.5*(- w.get0()*q.get1() - w.get1()*q.get2() - w.get2()*q.get3()) ); dq.set(1, 0.5*( w.get0()*q.get0() + w.get1()*q.get3() - w.get2()*q.get2()) ); dq.set(2, 0.5*(- w.get0()*q.get3() + w.get1()*q.get0() + w.get2()*q.get1()) ); dq.set(3, 0.5*( w.get0()*q.get2() - w.get1()*q.get1() + w.get2()*q.get0()) ); } }
public void dJointSetHingeAxisOffset( double x, double y, double z, double dangle ) { setAxes( x, y, z, _axis1, _axis2 ); computeInitialRelativeRotation(); if ( isFlagsReverse() ) dangle = -dangle; DQuaternion qAngle = new DQuaternion(), qOffset = new DQuaternion(); dQFromAxisAndAngle(qAngle, x, y, z, dangle); dQMultiply3(qOffset, qAngle, qrel); // qrel.v[0] = qOffset.v[0]; // qrel.v[1] = qOffset.v[1]; // qrel.v[2] = qOffset.v[2]; // qrel.v[3] = qOffset.v[3]; qrel.set(qOffset); }