| 65 |
|
/** |
| 66 |
|
* @class StuntDouble StuntDouble.hpp "Primitives/StuntDouble.hpp" |
| 67 |
|
* @brief |
| 68 |
+ |
* "Don't move, or you're dead! Stand up! Captain, we've got them!" |
| 69 |
+ |
* |
| 70 |
+ |
* "Spectacular stunt, my friends, but all for naught. Turn around |
| 71 |
+ |
* please. Ha. What a pity. What a pity. So, Princess, you thought |
| 72 |
+ |
* you could outwit the imperious forces of...." |
| 73 |
+ |
* |
| 74 |
+ |
* "You idiots! These are not them. You've captured their stunt |
| 75 |
+ |
* doubles! Search the area. Find them! Find them!" |
| 76 |
+ |
* |
| 77 |
|
* StuntDouble is a very strange idea. A StuntDouble stands in for |
| 78 |
|
* some object that can be manipulated by the Integrators or |
| 79 |
|
* Minimizers. Some of the manipulable objects are Atoms, some are |
| 80 |
|
* DirectionalAtoms, and some are RigidBodies. StuntDouble |
| 81 |
|
* provides an interface for the Integrators and Minimizers to use, |
| 82 |
|
* and does some preliminary sanity checking so that the program |
| 83 |
< |
* doesn't try to do something stupid like torque an Atom |
| 83 |
> |
* doesn't try to do something stupid like torque an Atom (The |
| 84 |
> |
* quotes above are from Spaceballs...) |
| 85 |
> |
* |
| 86 |
|
* @note the dynamic data of stuntdouble will be stored outside of the class |
| 87 |
|
*/ |
| 88 |
|
class StuntDouble{ |
| 165 |
|
*/ |
| 166 |
|
bool isDirectional(){ |
| 167 |
|
return isDirectionalAtom() || isRigidBody(); |
| 168 |
+ |
} |
| 169 |
+ |
|
| 170 |
+ |
/** |
| 171 |
+ |
* Freezes out all velocity, angular velocity, forces and torques |
| 172 |
+ |
* on this StuntDouble. Also computes the number of frozen degrees |
| 173 |
+ |
* of freedom. |
| 174 |
+ |
* @return the total number of frozen degrees of freedom |
| 175 |
+ |
*/ |
| 176 |
+ |
int freeze() { |
| 177 |
+ |
|
| 178 |
+ |
int fdf = 3; |
| 179 |
+ |
|
| 180 |
+ |
setVel(V3Zero); |
| 181 |
+ |
setFrc(V3Zero); |
| 182 |
+ |
if (isDirectional()){ |
| 183 |
+ |
setJ(V3Zero); |
| 184 |
+ |
setTrq(V3Zero); |
| 185 |
+ |
if (isLinear()) |
| 186 |
+ |
fdf +=2; |
| 187 |
+ |
else |
| 188 |
+ |
fdf +=3; |
| 189 |
+ |
} |
| 190 |
+ |
return fdf; |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
/** |