 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
33 double offset, d, dstd(0), dmin(1e30);
39 for ( i=0; i<3; i++ ) b[i] = 0;
41 for ( n=0, comp =
model->
comp; comp; comp = comp->
next, n++ ) {
44 for ( i=0; i<3; i++ ) {
45 for ( j=0; j<=i; j++ )
46 a[j][i] += loc[i]*loc[j];
58 }
else if ( a[1][1] == 0 ) {
60 }
else if ( a[2][2] == 0 ) {
68 offset = cen.
scalar(normal);
70 for ( n=0, comp =
model->
comp; comp; comp = comp->
next, n++ ) {
73 if ( fabs(dmin) > fabs(d) ) dmin = d;
80 if ( dmin < 0 ) normal = -normal;
104 double dp, dl, dpa(0), w, wa(0);
108 for ( comp = guide->
comp; comp; comp = comp->
next ) {
109 dvec = comp->
loc - loc;
139 double d, davg(0), dstd(0), sigma2(2*sigma*sigma);
144 cout <<
"Adjusting the model " <<
model->
id <<
" to the guide " << gmod->
id << endl;
145 cout <<
"Sigma: " << sigma << endl << endl;
150 for ( n=0, comp =
model->
comp; comp; comp = comp->
next, n++ ) {
153 if ( !
isfinite(d) ) cerr <<
"d not finite: " << d << endl;
156 comp->
loc += comp->
vec * d;
164 if ( dstd > 0 ) dstd = sqrt(dstd);
168 cout <<
"Average displacement: " << davg <<
" (" << dstd <<
")" << endl;
189 cerr <<
"Error: No guide model!" << endl;
199 cerr <<
"Error: The model creation from " << guide->
id <<
" failed!" << endl;
213 for ( i=0; i<3; i++ ) mat[i] = eigenvec[i];
217 View view(eigenvec[2][0], eigenvec[2][1], eigenvec[2][2], 0);
Vector3< double > model_fit_plane(Bmodel *model)
Fits a plane through a model.
int model_adjust_to_guide(Bmodel *model, Bmodel *gmod, double sigma)
Adjusts a shell model to the faces of a polyhedral guide model.
Vector3< double > model_principal_axes(Bmodel *model, Vector3< double > *eigenvec)
Calculates the principal axes of a model.
Bmodel * model_create_plane(double length, double width, double z, double distance)
Creates a plane with the given length, width, height, and component separation.
Vector3< double > model_center_of_mass(Bmodel *model)
double scalar(const Vector3 &v) const
Library routines used for model creation.
long model_set_views(Bmodel *model, View view)
Sets views.
double LU_decomposition()
Matrix inversion by LU decomposition.
Header file for general utilities.
ostream & tab(ostream &out)
Vector3< double > vector3()
bool isfinite(complex< T > &value)
Library routines used for analysing model component views.
Bmodel * model_generate_from_plane_guide(Bmodel *guide, double separation, double sigma)
Generates a plane model and fits a plane through it.
Library routines used for model processing.
double model_distance_to_guide(Vector3< double > loc, Vector3< double > vec, Bmodel *guide, double sigma2)
Calculates the distance between a location and the local guide model.