6 |
|
|
7 |
|
RigidBody::RigidBody() : StuntDouble() { |
8 |
|
objType = OT_RIGIDBODY; |
9 |
+ |
is_linear = false; |
10 |
+ |
linear_axis = -1; |
11 |
|
} |
12 |
|
|
13 |
|
RigidBody::~RigidBody() { |
263 |
|
|
264 |
|
void RigidBody::calcRefCoords( ) { |
265 |
|
|
266 |
< |
int i,j,k, it; |
266 |
> |
int i,j,k, it, n_linear_coords; |
267 |
|
double mtmp; |
268 |
|
vec3 apos; |
269 |
|
double refCOM[3]; |
330 |
|
|
331 |
|
// zero out I and then fill the diagonals with the moments of inertia: |
332 |
|
|
333 |
+ |
n_linear_coords = 0; |
334 |
+ |
|
335 |
|
for (i = 0; i < 3; i++) { |
336 |
|
for (j = 0; j < 3; j++) { |
337 |
|
I[i][j] = 0.0; |
338 |
|
} |
339 |
|
I[i][i] = evals[i]; |
340 |
+ |
|
341 |
+ |
if (fabs(evals[i]) < momIntTol) { |
342 |
+ |
is_linear = true; |
343 |
+ |
n_linear_coords++; |
344 |
+ |
linear_axis = i; |
345 |
+ |
} |
346 |
+ |
} |
347 |
+ |
|
348 |
+ |
if (n_linear_coords > 1) { |
349 |
+ |
sprintf( painCave.errMsg, |
350 |
+ |
"RigidBody error.\n" |
351 |
+ |
"\tOOPSE found more than one axis in this rigid body with a vanishing \n" |
352 |
+ |
"\tmoment of inertia. This can happen in one of three ways:\n" |
353 |
+ |
"\t 1) Only one atom was specified, or \n" |
354 |
+ |
"\t 2) All atoms were specified at the same location, or\n" |
355 |
+ |
"\t 3) The programmers did something stupid.\n" |
356 |
+ |
"\tIt is silly to use a rigid body to describe this situation. Be smarter.\n" |
357 |
+ |
); |
358 |
+ |
painCave.isFatal = 1; |
359 |
+ |
simError(); |
360 |
|
} |
361 |
|
|
362 |
|
// renormalize column vectors: |
625 |
|
} |
626 |
|
|
627 |
|
} |
628 |
+ |
|
629 |
+ |
void RigidBody::accept(BaseVisitor* v){ |
630 |
+ |
vector<Atom*>::iterator atomIter; |
631 |
+ |
v->visit(this); |
632 |
+ |
|
633 |
+ |
//for(atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter) |
634 |
+ |
// (*atomIter)->accept(v); |
635 |
+ |
} |