34 #ifndef CN3D_VECTORMATH__HPP
35 #define CN3D_VECTORMATH__HPP
49 Vector(
double xi = 0.0,
double yi = 0.0,
double zi = 0.0)
62 void Set(
double xs,
double ys,
double zs)
68 return (
x == other.
x &&
y == other.
y &&
z == other.
z);
72 return !(*
this == other);
76 static double err = 0.0;
78 else if (
i == 1)
return y;
79 else if (
i == 2)
return z;
86 else if (
i == 1)
return y;
87 else if (
i == 2)
return z;
137 return sqrt(
x*
x +
y*
y +
z*
z);
149 return (
a.x*
b.x +
a.y*
b.y +
a.z*
b.z);
163 return s <<
'<' << v.
x <<
',' << v.
y <<
',' << v.
z <<
'>';
169 Matrix(
double m0 =1,
double m1 =0,
double m2 =0,
double m3 =0,
170 double m4 =0,
double m5 =1,
double m6 =0,
double m7 =0,
171 double m8 =0,
double m9 =0,
double m10 =1,
double m11 =0,
172 double m12 =0,
double m13 =0,
double m14 =0,
double m15 =1) {
173 m[0]=m0;
m[1]=m1;
m[2]=m2;
m[3]=m3;
174 m[4]=m4;
m[5]=m5;
m[6]=m6;
m[7]=m7;
175 m[8]=m8;
m[9]=m9;
m[10]=m10;
m[11]=m11;
176 m[12]=m12;
m[13]=m13;
m[14]=m14;
m[15]=m15;
179 for (
int i=0;
i<16; ++
i)
m[
i]=o.
m[
i];
182 m[0] =
m[5] =
m[10] =
m[15] = 1;
183 m[1] =
m[2] =
m[3] =
m[4] =
m[6] =
m[7] =
184 m[8] =
m[9] =
m[11] =
m[12] =
m[13] =
m[14] = 0;
187 for (
int i=0;
i<16; ++
i)
m[
i]=o.
m[
i];
192 static double err = 0.0;
218 int natx,
const Vector *
const *xref,
const Vector *
const *xvar,
const double *weights,
223 const Vector *
const *dependentCoords,
const Matrix *transformDependentToMaster);
virtual T * operator[](size_t i_)
Matrix(double m0=1, double m1=0, double m2=0, double m3=0, double m4=0, double m5=1, double m6=0, double m7=0, double m8=0, double m9=0, double m10=1, double m11=0, double m12=0, double m13=0, double m14=0, double m15=1)
Matrix & operator=(const Matrix &matrix_)
Vector & operator+=(const Vector &v)
double lengthSquared(void) const
friend Vector operator+(const Vector &a, const Vector &b)
bool operator==(const Vector &other)
bool operator!=(const Vector &other)
Vector & operator/=(double f)
Vector & operator*=(double f)
double length(void) const
virtual T & operator[](size_t i_)
friend Vector operator-(const Vector &a)
friend double vector_dot(const Vector &a, const Vector &b)
friend Vector vector_cross(const Vector &a, const Vector &b)
Vector & operator=(const Vector &vector_)
Vector(double xi=0.0, double yi=0.0, double zi=0.0)
friend Vector operator/(const Vector &v, double f)
void Set(double xs, double ys, double zs)
friend Vector operator*(const Vector &v, double f)
Vector & operator-=(const Vector &v)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Defines NCBI C++ diagnostic APIs, classes, and macros.
The NCBI C++/STL use hints.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
void InvertInto(Matrix *I, const Matrix &A)
void SetTranslationMatrix(Matrix *m, const Vector &v, int n=1)
ncbi::CNcbiOstream & operator<<(ncbi::CNcbiOstream &s, const Vector &v)
void SetRotationMatrix(Matrix *m, const Vector &v, double rad, int n=1)
double ComputeRMSD(int nCoords, const Vector *const *masterCoords, const Vector *const *dependentCoords, const Matrix *transformDependentToMaster)
void ComposeInto(Matrix *C, const Matrix &A, const Matrix &B)
void ApplyTransformation(Vector *v, const Matrix &m)
void SetScaleMatrix(Matrix *m, const Vector &v)
void RigidBodyFit(int natx, const Vector *const *xref, const Vector *const *xvar, const double *weights, Vector &cgref, Vector &cgvar, Matrix &rotMat)