| 33 |
|
#ifndef PRIMITIVES_RIGIDBODY_HPP |
| 34 |
|
#define PRIMITIVES_RIGIDBODY_HPP |
| 35 |
|
|
| 36 |
< |
#include "primitives/Atom.hpp" |
| 36 |
> |
#include <vector> |
| 37 |
|
|
| 38 |
+ |
#include "primitives/StuntDouble.hpp" |
| 39 |
+ |
|
| 40 |
|
namespace oopse{ |
| 41 |
< |
class RigidBody : public Atom { |
| 41 |
> |
class RigidBody : public StuntDouble { |
| 42 |
|
public: |
| 43 |
|
RigidBody(); |
| 44 |
|
|
| 64 |
|
/** |
| 65 |
|
* Returns the inertia tensor of this stuntdouble |
| 66 |
|
* @return the inertia tensor of this stuntdouble |
| 65 |
– |
* @see #setI |
| 67 |
|
*/ |
| 68 |
|
virtual Mat3x3d getI(); |
| 69 |
|
|
| 69 |
– |
/** |
| 70 |
– |
* Sets the inertia tensor of this stuntdouble |
| 71 |
– |
* @param trq new inertia tensor |
| 72 |
– |
* @see #getI |
| 73 |
– |
*/ |
| 74 |
– |
virtual void setI(Mat3x3d& I); |
| 70 |
|
|
| 71 |
+ |
/** Sets the internal unit frame of this stuntdouble by three euler angles */ |
| 72 |
+ |
void setUnitFrameFromEuler(double phi, double theta, double psi); |
| 73 |
+ |
|
| 74 |
|
/** |
| 75 |
|
* Returns the gradient of this stuntdouble |
| 76 |
|
* @return the inertia tensor of this stuntdouble |
| 95 |
|
* Returns the atoms of this rigid body |
| 96 |
|
* @return the atoms of this rigid body in a vector |
| 97 |
|
*/ |
| 98 |
< |
vector<Atom*> getAtoms() { return atoms_;} |
| 98 |
> |
std::vector<Atom*> getAtoms() { |
| 99 |
> |
return atoms_; |
| 100 |
> |
} |
| 101 |
|
|
| 102 |
|
/** |
| 103 |
|
* Returns the number of atoms in this rigid body |
| 104 |
|
* @return the number of atoms in this rigid body |
| 105 |
|
*/ |
| 106 |
< |
int getNumAtoms() {return atomLists_.size();} |
| 106 |
> |
int getNumAtoms() { |
| 107 |
> |
return atoms_.size(); |
| 108 |
> |
} |
| 109 |
|
|
| 110 |
< |
|
| 111 |
< |
bool getAtomPos(Vector3d& pos, int index); |
| 110 |
> |
/** |
| 111 |
> |
* Return the position of atom which belongs to this rigid body. |
| 112 |
> |
* @return true if index is valid otherwise return false |
| 113 |
> |
* @param pos the position of atom which will be set on return if index is valid |
| 114 |
> |
* @param index the index of the atom in rigid body's private data member atoms_ |
| 115 |
> |
*/ |
| 116 |
> |
bool getAtomPos(Vector3d& pos, unsigned int index); |
| 117 |
> |
|
| 118 |
> |
/** |
| 119 |
> |
* Return the position of atom which belongs to this rigid body. |
| 120 |
> |
* @return true if atom belongs to this rigid body,otherwise return false |
| 121 |
> |
* @param pos position of atom which will be set on return if atom belongs to this rigid body |
| 122 |
> |
* @param atom the pointer to an atom |
| 123 |
> |
*/ |
| 124 |
|
bool getAtomPos(Vector3d& pos, Atom* atom); |
| 125 |
|
|
| 126 |
< |
bool getAtomVel(Vector3d& vel, int index); |
| 126 |
> |
/** |
| 127 |
> |
* Return the velocity of atom which belongs to this rigid body. |
| 128 |
> |
* @return true if index is valid otherwise return false |
| 129 |
> |
* @param vel the velocity of atom which will be set on return if index is valid |
| 130 |
> |
* @param index the index of the atom in rigid body's private data member atoms_ |
| 131 |
> |
*/ |
| 132 |
> |
bool getAtomVel(Vector3d& vel, unsigned int index); |
| 133 |
> |
|
| 134 |
> |
/** |
| 135 |
> |
* Return the velocity of atom which belongs to this rigid body. |
| 136 |
> |
* @return true if atom belongs to this rigid body,otherwise return false |
| 137 |
> |
* @param vel velocity of atom which will be set on return if atom belongs to this rigid body |
| 138 |
> |
* @param atom the pointer to an atom |
| 139 |
> |
*/ |
| 140 |
|
bool getAtomVel(Vector3d& vel, Atom*); |
| 141 |
|
|
| 142 |
< |
bool getAtomRefCoor(Vector3d& coor, int index); |
| 142 |
> |
/** |
| 143 |
> |
* Return the reference coordinate of atom which belongs to this rigid body. |
| 144 |
> |
* @return true if index is valid otherwise return false |
| 145 |
> |
* @param coor the reference coordinate of atom which will be set on return if index is valid |
| 146 |
> |
* @param index the index of the atom in rigid body's private data member atoms_ |
| 147 |
> |
*/ |
| 148 |
> |
bool getAtomRefCoor(Vector3d& coor, unsigned int index); |
| 149 |
> |
|
| 150 |
> |
/** |
| 151 |
> |
* Return the velocity of atom which belongs to this rigid body. |
| 152 |
> |
* @return true if atom belongs to this rigid body,otherwise return false |
| 153 |
> |
* @param coor velocity of atom which will be set on return if atom belongs to this rigid body |
| 154 |
> |
* @param atom the pointer to an atom |
| 155 |
> |
*/ |
| 156 |
|
bool getAtomRefCoor(Vector3d& coor, Atom* atom); |
| 157 |
|
|
| 158 |
|
private: |
| 160 |
|
Mat3x3d inertiaTensor_; |
| 161 |
|
RotMat3x3d sU_; /**< body fixed standard unit vector */ |
| 162 |
|
|
| 163 |
< |
vector<Atom*> atoms_; |
| 164 |
< |
vector<Vector3d> refCoords; |
| 163 |
> |
std::vector<Atom*> atoms_; |
| 164 |
> |
std::vector<Vector3d> refCoords_; |
| 165 |
|
}; |
| 166 |
|
|
| 167 |
|
}//namepace oopse |