ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/SHAPES/RigidBody.hpp
Revision: 1271
Committed: Tue Jun 15 20:20:36 2004 UTC (20 years, 10 months ago) by gezelter
File size: 1977 byte(s)
Log Message:
Major changes for rigidbodies

File Contents

# Content
1 #ifndef __RIGIDBODY_HPP__
2 #define __RIGIDBODY_HPP__
3
4 #include <vector>
5 using namespace std;
6
7 class VDWAtom;
8
9 typedef struct {
10 double vec[3];
11 double& operator[](int index) {return vec[index];}
12 } vec3;
13
14 typedef struct {
15 double mat[3][3];
16 double* operator[](int index) {return mat[index];}
17 } mat3x3;
18
19 class RigidBody {
20
21 public:
22
23 RigidBody();
24 virtual ~RigidBody();
25
26 void addAtom(VDWAtom* at);
27
28 void getPos( double theP[3] );
29 void setPos( double theP[3] );
30
31 virtual bool isLinear() {return is_linear;}
32 virtual int linearAxis() {return linear_axis;}
33
34 double getMass( void ) { return mass; }
35
36 void setEuler( double phi, double theta, double psi );
37 void getQ( double the_q[4] ); // get the quanternions
38 void setQ( double the_q[4] );
39
40 void getA( double the_A[3][3] ); // get the full rotation matrix
41 void setA( double the_A[3][3] );
42
43 void getI( double the_I[3][3] );
44 void lab2Body( double r[3] );
45 void body2Lab( double r[3] );
46
47 void calcRefCoords( void );
48 void doEulerToRotMat(vec3 &euler, mat3x3 &myA );
49 void updateAtoms( void );
50
51 void getGrad(double gradient[6] );
52 void getEulerAngles( double myEuler[3] );
53
54 double max(double x, double y);
55 double min(double x, double y);
56
57 // utility routines
58
59 void findCOM( void );
60
61 vector<VDWAtom*> getAtoms() { return myAtoms;}
62 int getNumAtoms() {return myAtoms.size();}
63
64 void getAtomPos(double theP[3], int index);
65 void getAtomRefCoor(double pos[3], int index);
66 protected:
67
68 double mass; // the total mass
69 double pos[3]; // the position array (center of mass)
70 double A[3][3]; // the rotation matrix
71 double I[3][3]; // the inertial tensor (body fixed)
72 double sU[3][3]; // the standard unit vectors (body fixed)
73
74 bool is_linear;
75 int linear_axis;
76 double momIntTol;
77
78 vector<VDWAtom*> myAtoms; // the vector of atoms
79 vector<vec3> refCoords;
80 vector<mat3x3> refOrients;
81
82 char rbName[100]; //it will eventually be converted into string
83 };
84
85 #endif