Changeset 0d111b for molecuilder/src/ellipsoid.cpp
- Timestamp:
- Apr 29, 2010, 1:55:21 PM (16 years ago)
- Children:
- 070651, 5d1a94
- Parents:
- 90c4460 (diff), 32842d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
molecuilder/src/ellipsoid.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/ellipsoid.cpp
r90c4460 r0d111b 42 42 43 43 // 1. translate coordinate system so that ellipsoid center is in origin 44 helper.CopyVector(&x); 45 helper.SubtractVector(&EllipsoidCenter); 46 RefPoint.CopyVector(&helper); 44 RefPoint = helper = x - EllipsoidCenter; 47 45 //Log() << Verbose(4) << "Translated given point is at " << RefPoint << "." << endl; 48 46 … … 61 59 Matrix[8] = cos(theta); 62 60 helper.MatrixMultiplication(Matrix); 63 helper.Scale (InverseLength);61 helper.ScaleAll(InverseLength); 64 62 //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl; 65 63 … … 72 70 theta = -EllipsoidAngle[1]; 73 71 phi = -EllipsoidAngle[2]; 74 helper.Scale (EllipsoidLength);72 helper.ScaleAll(EllipsoidLength); 75 73 Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi); 76 74 Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi); … … 86 84 87 85 // 5. determine distance between backtransformed point and x 88 distance = RefPoint.DistanceSquared( &helper);86 distance = RefPoint.DistanceSquared(helper); 89 87 //Log() << Verbose(4) << "Squared distance between intersection and RefPoint is " << distance << "." << endl; 90 88 … … 116 114 // put parameters into suitable ellipsoid form 117 115 for (int i=0;i<3;i++) { 118 Center .x[i] = gsl_vector_get(x, i+0);116 Center[i] = gsl_vector_get(x, i+0); 119 117 EllipsoidLength[i] = gsl_vector_get(x, i+3); 120 118 EllipsoidAngle[i] = gsl_vector_get(x, i+6); … … 160 158 x = gsl_vector_alloc (9); 161 159 for (int i=0;i<3;i++) { 162 gsl_vector_set (x, i+0, EllipsoidCenter-> x[i]);160 gsl_vector_set (x, i+0, EllipsoidCenter->at(i)); 163 161 gsl_vector_set (x, i+3, EllipsoidLength[i]); 164 162 gsl_vector_set (x, i+6, EllipsoidAngle[i]); … … 195 193 if (status == GSL_SUCCESS) { 196 194 for (int i=0;i<3;i++) { 197 EllipsoidCenter-> x[i]= gsl_vector_get (s->x,i+0);195 EllipsoidCenter->at(i) = gsl_vector_get (s->x,i+0); 198 196 EllipsoidLength[i] = gsl_vector_get (s->x, i+3); 199 197 EllipsoidAngle[i] = gsl_vector_get (s->x, i+6); … … 304 302 Candidate = (*Runner); 305 303 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl); 306 x[PointsPicked++] .CopyVector(Candidate->node); // we have one more atom picked304 x[PointsPicked++] = *Candidate->node; // we have one more atom picked 307 305 current++; // next pre-picked atom 308 306 } … … 350 348 //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": "; 351 349 if (value > threshold) { 352 x[PointsPicked] .CopyVector(Runner->second->node->node);350 x[PointsPicked] = (*Runner->second->node->node); 353 351 PointsPicked++; 354 352 //Log() << Verbose(0) << "IN." << endl; … … 387 385 Center.Zero(); 388 386 for (PointMap::iterator Runner = T->PointsOnBoundary.begin(); Runner != T->PointsOnBoundary.end(); Runner++) 389 Center .AddVector(Runner->second->node->node);387 Center += (*Runner->second->node->node); 390 388 Center.Scale(1./T->PointsOnBoundaryCount); 391 389 DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl); … … 405 403 // calculate some sensible starting values for parameter fit 406 404 MaxDistance = 0.; 407 MinDistance = x[0].ScalarProduct( &x[0]);405 MinDistance = x[0].ScalarProduct(x[0]); 408 406 for (int i=0;i<N;i++) { 409 distance = x[i].ScalarProduct( &x[i]);407 distance = x[i].ScalarProduct(x[i]); 410 408 if (distance > MaxDistance) 411 409 MaxDistance = distance; … … 414 412 } 415 413 //Log() << Verbose(2) << "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << "." << endl; 416 EllipsoidCenter .CopyVector(&Center); // use Center of Gravity as initial center of ellipsoid414 EllipsoidCenter = Center; // use Center of Gravity as initial center of ellipsoid 417 415 for (int i=0;i<3;i++) 418 416 EllipsoidAngle[i] = 0.; … … 427 425 output << number << "\t"; 428 426 for (int i=0;i<3;i++) 429 output << setprecision(9) << EllipsoidCenter .x[i] << "\t";427 output << setprecision(9) << EllipsoidCenter[i] << "\t"; 430 428 for (int i=0;i<3;i++) 431 429 output << setprecision(9) << EllipsoidLength[i] << "\t";
Note:
See TracChangeset
for help on using the changeset viewer.
