MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / dInternalStepIsland_x1

Function dInternalStepIsland_x1

3rd_party/Src/ode/ode/src/step.cpp:216–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214// `_joint' is the body array, `nj' is the size of the array.
215
216void dInternalStepIsland_x1 (dxWorld *world, dxBody * const *body, int nb,
217 dxJoint * const *_joint, int nj, dReal stepsize)
218{
219 int i,j,k;
220 int n6 = 6*nb;
221
222# ifdef TIMING
223 dTimerStart("preprocessing");
224# endif
225
226 // number all bodies in the body list - set their tag values
227 for (i=0; i<nb; i++) body[i]->tag = i;
228
229 // make a local copy of the joint array, because we might want to modify it.
230 // (the "dxJoint *const*" declaration says we're allowed to modify the joints
231 // but not the joint array, because the caller might need it unchanged).
232 dxJoint **joint = (dxJoint**) ALLOCA (nj * sizeof(dxJoint*));
233 memcpy (joint,_joint,nj * sizeof(dxJoint*));
234
235 // for all bodies, compute the inertia tensor and its inverse in the global
236 // frame, and compute the rotational force and add it to the torque
237 // accumulator.
238 // @@@ check computation of rotational force.
239 dReal *I = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
240 dReal *invI = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
241
242 //dSetZero (I,3*nb*4);
243 //dSetZero (invI,3*nb*4);
244 for (i=0; i<nb; i++) {
245 dReal tmp[12];
246 // compute inertia tensor in global frame
247 dMULTIPLY2_333 (tmp,body[i]->mass.I,body[i]->R);
248 dMULTIPLY0_333 (I+i*12,body[i]->R,tmp);
249 // compute inverse inertia tensor in global frame
250 dMULTIPLY2_333 (tmp,body[i]->invI,body[i]->R);
251 dMULTIPLY0_333 (invI+i*12,body[i]->R,tmp);
252 // compute rotational force
253 dMULTIPLY0_331 (tmp,I+i*12,body[i]->avel);
254 dCROSS (body[i]->tacc,-=,body[i]->avel,tmp);
255 }
256
257 // add the gravity force to all bodies
258 for (i=0; i<nb; i++) {
259 if ((body[i]->flags & dxBodyNoGravity)==0) {
260 body[i]->facc[0] += body[i]->mass.mass * world->gravity[0];
261 body[i]->facc[1] += body[i]->mass.mass * world->gravity[1];
262 body[i]->facc[2] += body[i]->mass.mass * world->gravity[2];
263 }
264 }
265
266 // get m = total constraint dimension, nub = number of unbounded variables.
267 // create constraint offset array and number-of-rows array for all joints.
268 // the constraints are re-ordered as follows: the purely unbounded
269 // constraints, the mixed unbounded + LCP constraints, and last the purely
270 // LCP constraints.
271 //
272 // joints with m=0 are inactive and are removed from the joints array
273 // entirely, so that the code that follows does not consider them.

Callers 1

dInternalStepIslandFunction · 0.85

Calls 12

dTimerStartFunction · 0.85
dTimerNowFunction · 0.85
dSetZeroFunction · 0.85
dSetValueFunction · 0.85
dMultiply0Function · 0.85
dMultiply2Function · 0.85
dSolveLCPFunction · 0.85
dMultiply1Function · 0.85
dxStepBodyFunction · 0.85
dTimerEndFunction · 0.85
dTimerReportFunction · 0.85
nextMatrixMethod · 0.80

Tested by

no test coverage detected