Changeset fda112 for molecuilder
- Timestamp:
- Apr 22, 2010, 2:10:08 PM (16 years ago)
- Children:
- 447896
- Parents:
- d22a30
- File:
-
- 1 edited
-
molecuilder/src/tesselation.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/tesselation.cpp
rd22a30 rfda112 3255 3255 if (radius < RADIUS * RADIUS) { 3256 3256 otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter); 3257 if (fabs(radius - otherradius) > HULLEPSILON) { 3258 DoeLog(1) && (eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl); 3259 } 3260 // construct both new centers 3261 NewSphereCenter.CopyVector(&NewPlaneCenter); 3262 OtherNewSphereCenter.CopyVector(&NewPlaneCenter); 3263 helper.CopyVector(&NewNormalVector); 3264 helper.Scale(sqrt(RADIUS * RADIUS - radius)); 3265 DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl); 3266 NewSphereCenter.AddVector(&helper); 3267 DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl); 3268 // OtherNewSphereCenter is created by the same vector just in the other direction 3269 helper.Scale(-1.); 3270 OtherNewSphereCenter.AddVector(&helper); 3271 DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl); 3272 3273 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 3274 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 3275 alpha = min(alpha, Otheralpha); 3276 3277 // if there is a better candidate, drop the current list and add the new candidate 3278 // otherwise ignore the new candidate and keep the list 3279 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 3280 if (fabs(alpha - Otheralpha) > MYEPSILON) { 3281 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 3282 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 3257 if (fabs(radius - otherradius) < HULLEPSILON) { 3258 // construct both new centers 3259 NewSphereCenter.CopyVector(&NewPlaneCenter); 3260 OtherNewSphereCenter.CopyVector(&NewPlaneCenter); 3261 helper.CopyVector(&NewNormalVector); 3262 helper.Scale(sqrt(RADIUS * RADIUS - radius)); 3263 DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl); 3264 NewSphereCenter.AddVector(&helper); 3265 DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl); 3266 // OtherNewSphereCenter is created by the same vector just in the other direction 3267 helper.Scale(-1.); 3268 OtherNewSphereCenter.AddVector(&helper); 3269 DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl); 3270 3271 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 3272 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 3273 alpha = min(alpha, Otheralpha); 3274 3275 // if there is a better candidate, drop the current list and add the new candidate 3276 // otherwise ignore the new candidate and keep the list 3277 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 3278 if (fabs(alpha - Otheralpha) > MYEPSILON) { 3279 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 3280 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 3281 } else { 3282 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 3283 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 3284 } 3285 // if there is an equal candidate, add it to the list without clearing the list 3286 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 3287 CandidateLine.pointlist.push_back(Candidate); 3288 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl); 3289 } else { 3290 // remove all candidates from the list and then the list itself 3291 CandidateLine.pointlist.clear(); 3292 CandidateLine.pointlist.push_back(Candidate); 3293 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl); 3294 } 3295 CandidateLine.ShortestAngle = alpha; 3296 DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl); 3283 3297 } else { 3284 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 3285 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 3298 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 3299 DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl); 3300 } else { 3301 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl); 3302 } 3286 3303 } 3287 // if there is an equal candidate, add it to the list without clearing the list3288 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {3289 CandidateLine.pointlist.push_back(Candidate);3290 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);3291 } else {3292 // remove all candidates from the list and then the list itself3293 CandidateLine.pointlist.clear();3294 CandidateLine.pointlist.push_back(Candidate);3295 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);3296 }3297 CandidateLine.ShortestAngle = alpha;3298 DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);3299 3304 } else { 3300 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 3301 DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl); 3302 } else { 3303 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl); 3304 } 3305 DoLog(1) && (Log() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl); 3305 3306 } 3306 3307 } else {
Note:
See TracChangeset
for help on using the changeset viewer.
