ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/SHAPES/RigidBody.hpp
Revision: 1276
Committed: Thu Jun 17 21:27:38 2004 UTC (20 years ago) by chrisfen
File size: 2021 byte(s)
Log Message:
Cleaned up unused variables.  Added findMaxExtent to RigidBody.cpp

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(double euler[3], double myA[3][3] );
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 double findMaxExtent( void );
58
59 // utility routines
60
61 void findCOM( void );
62
63 vector<VDWAtom*> getAtoms() { return myAtoms;}
64 int getNumAtoms() {return myAtoms.size();}
65
66 void getAtomPos(double theP[3], int index);
67 void getAtomRefCoor(double pos[3], int index);
68 protected:
69
70 double mass; // the total mass
71 double pos[3]; // the position array (center of mass)
72 double A[3][3]; // the rotation matrix
73 double I[3][3]; // the inertial tensor (body fixed)
74 double sU[3][3]; // the standard unit vectors (body fixed)
75
76 bool is_linear;
77 int linear_axis;
78 double momIntTol;
79
80 vector<VDWAtom*> myAtoms; // the vector of atoms
81 vector<vec3> refCoords;
82 vector<mat3x3> refOrients;
83
84 char rbName[100]; //it will eventually be converted into string
85 };
86
87 #endif