Vector.cpp (pymol-v1.8.6.0.tar.bz2) | : | Vector.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 388 | skipping to change at line 388 | |||
for (int j = 0; j < ncol; j++) { | for (int j = 0; j < ncol; j++) { | |||
int a1 = i * ncol1 + j, a2 = i * ncol2 + j; | int a1 = i * ncol1 + j, a2 = i * ncol2 + j; | |||
if (fabsf(m1[a1] - m2[a2]) > threshold) | if (fabsf(m1[a1] - m2[a2]) > threshold) | |||
return false; | return false; | |||
} | } | |||
} | } | |||
return true; | return true; | |||
} | } | |||
/* | /* | |||
* Check a nxm matrix is a diagonal matrix (non-diagonal elements are zero) | ||||
*/ | ||||
bool is_diagonalf(int nrow, | ||||
const float *m, int ncol, float threshold) | ||||
{ | ||||
if (!ncol) | ||||
ncol = nrow; | ||||
for (int i = 0; i < nrow; ++i) { | ||||
for (int j = 0; j < ncol; ++j) { | ||||
if (i != j && fabsf(m[i * ncol + j]) > threshold) | ||||
return false; | ||||
} | ||||
} | ||||
return true; | ||||
} | ||||
/* | ||||
* Determinant of the upper left 3x3 submatrix. | * Determinant of the upper left 3x3 submatrix. | |||
*/ | */ | |||
double determinant33f(const float *m, int ncol) | double determinant33f(const float *m, int ncol) | |||
{ | { | |||
int &a = ncol, b = ncol * 2; | int &a = ncol, b = ncol * 2; | |||
return | return | |||
m[0] * (m[a + 1] * (double) m[b + 2] - m[a + 2] * (double) m[b + 1]) - | m[0] * (m[a + 1] * (double) m[b + 2] - m[a + 2] * (double) m[b + 1]) - | |||
m[1] * (m[a + 0] * (double) m[b + 2] - m[a + 2] * (double) m[b + 0]) + | m[1] * (m[a + 0] * (double) m[b + 2] - m[a + 2] * (double) m[b + 0]) + | |||
m[2] * (m[a + 0] * (double) m[b + 1] - m[a + 1] * (double) m[b + 0]); | m[2] * (m[a + 0] * (double) m[b + 1] - m[a + 1] * (double) m[b + 0]); | |||
} | } | |||
skipping to change at line 1610 | skipping to change at line 1627 | |||
} | } | |||
} | } | |||
return (result); | return (result); | |||
} | } | |||
float get_angle3f(const float *v1, const float *v2) | float get_angle3f(const float *v1, const float *v2) | |||
{ | { | |||
double denom; | double denom; | |||
double result; | double result; | |||
double arg1, arg2; | double arg1, arg2; | |||
arg1 = ((v1[0] * v1[0]) + (v1[1] * v1[1]) + (v1[2] * v1[2])); | arg1 = ((v1[0] * (double)v1[0]) + (v1[1] * (double)v1[1]) + (v1[2] * (double)v | |||
arg2 = ((v2[0] * v2[0]) + (v2[1] * v2[1]) + (v2[2] * v2[2])); | 1[2])); | |||
arg2 = ((v2[0] * (double)v2[0]) + (v2[1] * (double)v2[1]) + (v2[2] * (double)v | ||||
2[2])); | ||||
denom = sqrt1d(arg1) * sqrt1d(arg2); | denom = sqrt1d(arg1) * sqrt1d(arg2); | |||
if(denom > R_SMALL){ | if(denom > R_SMALL){ | |||
arg1 = (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]); | arg1 = (v1[0] * (double)v2[0] + v1[1] * (double)v2[1] + v1[2] * (double)v2[2 ]); | |||
result = arg1 / denom; | result = arg1 / denom; | |||
} else | } else | |||
result = _0; | result = _0; | |||
if(result < -_1) | if(result < -_1) | |||
result = -_1; | result = -_1; | |||
else if(result > _1) | else if(result > _1) | |||
result = _1; | result = _1; | |||
result = acos(result); | ||||
return ((float) result); | return acosf(result); | |||
} | } | |||
void normalize23f(const float *v1, float *v2) | void normalize23f(const float *v1, float *v2) | |||
{ | { | |||
double vlen; | double vlen; | |||
vlen = length3f(v1); | vlen = length3f(v1); | |||
if(vlen > R_SMALL) { | if(vlen > R_SMALL) { | |||
v2[0] = (float) (v1[0] / vlen); | v2[0] = (float) (v1[0] / vlen); | |||
v2[1] = (float) (v1[1] / vlen); | v2[1] = (float) (v1[1] / vlen); | |||
v2[2] = (float) (v1[2] / vlen); | v2[2] = (float) (v1[2] / vlen); | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 24 lines changed or added |