00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __P_BOND_H
00021 #define __P_BOND_H
00022
00023 #include "PEnums.h"
00024
00031 class PBond {
00032 public:
00033 friend struct DOFCacher;
00034
00038 PBond(PAtom *a1, PAtom *a2, bool isDOF) {
00039 m_atom1 = a1;
00040 m_atom2 = a2;
00041 m_isDOF = isDOF;
00042 m_forwardDirection = NULL;
00043 a1->m_bonds.push_back(this);
00044 a2->m_bonds.push_back(this);
00045 }
00046
00047
00051 Real getLength();
00052
00058 void traverseChain(BondDirection dir, AtomFunctor *atomFn, BondFunctor *bondFn, PChain *rootChain);
00059
00065 void traverseAtoms(BondDirection dir, AtomFunctor *atomFn, PChain *rootChain) {
00066 traverseChain(dir, atomFn, NULL, rootChain);
00067 }
00068
00074 void traverseBonds(BondDirection dir, BondFunctor *bondFn, PChain *rootChain) {
00075 traverseChain(dir, NULL, bondFn, rootChain);
00076 }
00077
00083 void Rotate(BondDirection dir, float degrees, PChain *chain);
00084
00088 void Rotate(BondDirection dir, float degrees);
00089
00093 PAtom *getAtom1() const { return m_atom1; }
00094
00098 PAtom *getAtom2() const { return m_atom2; }
00099
00104 PAtom *getAtom(BondDirection dir) const;
00105
00110 bool isDOF() const { return m_isDOF; }
00111
00112 private:
00113
00114
00115
00116
00117
00118 void setDirection(PAtom *front) { m_forwardDirection = front; }
00119
00120 PAtom *m_atom1;
00121 PAtom *m_atom2;
00122 PAtom *m_forwardDirection;
00123 bool m_isDOF;
00124 };
00125
00126 #endif // __P_BOND_H