17 #ifndef _INTCOORDCONVERTER_H_
18 #define _INTCOORDCONVERTER_H_
27 namespace Victor {
namespace Biopool {
33 const static double EPSILON = 0.0001;
35 const double RAD2DEG = 180 / M_PI;
36 const double DEG2RAD = M_PI / 180;
38 const double UNDEFINED_ANGLE = DEG2RAD * 999;
57 double getAngle(vgVector3<double>& p11, vgVector3<double>& p12,
58 vgVector3<double>& p21, vgVector3<double>& p22);
60 double getAngle(vgVector3<double>& v1, vgVector3<double>& v2);
62 vgVector3<double>
calculateTrans(vgVector3<double>& p1, vgVector3<double>& p2);
64 vgMatrix3<double>
calculateRot(vgVector3<double>& p11, vgVector3<double>& p12,
65 vgVector3<double>& p21, vgVector3<double>& p22);
73 double angle,
double old_angle);
74 void setBondLength(
Atom& a1,
Atom& a2,
double length);
79 const double bondAngle,
Atom& attAP,
80 const double torsionAngle,
const int chiral,
Atom& at);
86 double normalize(
double angle)
const;
117 angle(
const vgVector3<double>& a,
const vgVector3<double>& b) {
118 PRECOND(a.length() * b.length() != 0.0,
121 long double d = (a * b) / (a.length() * b.length());
129 INVARIANT(fabs(d) <= 1.0, logic_error);
140 angle(
const vgVector3<float>& a,
const vgVector3<float>& b) {
141 PRECOND(a.length() * b.length() != 0.0,
144 long double d = (a * b) / (a.length() * b.length());
152 INVARIANT(fabs(d) <= 1.0, logic_error);
163 inline void alignVectors(vgVector3<double> v1, vgVector3<double> v2,
164 vgMatrix3<double>& res) {
165 PRECOND(v1.length() * v2.length() != 0.0, exception);
168 if ((v1 + v2).length() < EPSILON)
170 vgVector3<double> axis = (v1.normalize()).cross(v2.normalize());
171 res = vgMatrix3<double>::createRotationMatrix(axis, -angle(v1.normalize(),
176 POSTCOND((v2.normalize() - v1.normalize()).length() < EPSILON, exception);
185 alignVectors(vgVector3<float> v1, vgVector3<float> v2,
186 vgMatrix3<float>& res) {
187 PRECOND(v1.length() * v2.length() != 0.0, exception);
190 if ((v1 + v2).length() < EPSILON)
192 vgVector3<float> axis = (v1.normalize()).cross(v2.normalize());
193 res = vgMatrix3<float>::createRotationMatrix(axis, -angle(v1.normalize(),
198 POSTCOND((v2.normalize() - v1.normalize()).length() < EPSILON, exception);
203 #endif //_INTCOORDCONVERTER_H_
void zAtomToCartesian(Atom &atbLP, const double bondLength, Atom &atbAP, const double bondAngle, Atom &attAP, const double torsionAngle, const int chiral, Atom &at)
Definition: IntCoordConverter.cc:366
static double getTorsionAngle(Atom &a1, Atom &a2, Atom &a3, Atom &a4)
Definition: IntCoordConverter.cc:127
double getAngleDifference(double a, double b) const
Definition: IntCoordConverter.cc:168
double getAngle(vgVector3< double > &p11, vgVector3< double > &p12, vgVector3< double > &p21, vgVector3< double > &p22)
returns angle between vectors detected by couple of points
Definition: IntCoordConverter.cc:42
vgMatrix3< double > calculateRot(vgVector3< double > &p11, vgVector3< double > &p12, vgVector3< double > &p21, vgVector3< double > &p22)
calculates rotation matrix that rotate a vector into another
Definition: IntCoordConverter.cc:76
static double getBondLength(Atom &a1, Atom &a2)
Definition: IntCoordConverter.cc:112
void setBondAngle(Atom &a1, Atom &a2, Atom &a3, double angle)
Definition: IntCoordConverter.cc:183
Implements a simple atom type.
Definition: Atom.h:39
static double getBondAngle(Atom &a1, Atom &a2, Atom &a3)
Definition: IntCoordConverter.cc:95
void setTorsionAngle(Atom &a1, Atom &a2, Atom &a3, Atom &a4, double angle)
Definition: IntCoordConverter.cc:220
It mplements a simple amino acid.
Definition: AminoAcid.h:43
Implements methods to manage translation vector and angles between vectors.
Definition: IntCoordConverter.h:46
vgVector3< double > calculateTrans(vgVector3< double > &p1, vgVector3< double > &p2)
returns translation vector that translates a point into another
Definition: IntCoordConverter.cc:66