Changeset 47d041 for src/Tesselation/tesselation.cpp
- Timestamp:
- Nov 3, 2011, 7:44:01 PM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 41a467
- Parents:
- 50e4e5
- git-author:
- Frederik Heber <heber@…> (10/27/11 11:53:58)
- git-committer:
- Frederik Heber <heber@…> (11/03/11 19:44:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tesselation/tesselation.cpp
r50e4e5 r47d041 22 22 #include <fstream> 23 23 #include <iomanip> 24 #include <sstream> 24 25 25 26 #include "BoundaryPointSet.hpp" … … 76 77 { 77 78 Info FunctionInfo(__func__); 78 DoLog(0) && (Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl);79 LOG(0, "Free'ing TesselStruct ... "); 79 80 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 80 81 if (runner->second != NULL) { … … 82 83 runner->second = NULL; 83 84 } else 84 DoeLog(1) && (eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl);85 } 86 DoLog(0) && (Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl);85 ELOG(1, "The triangle " << runner->first << " has already been free'd."); 86 } 87 LOG(0, "This envelope was written to file " << TriangleFilesWritten << " times(s)."); 87 88 } 88 89 … … 121 122 } 122 123 } 123 // // listing distances 124 // Log() << Verbose(1) << "Listing DistanceMMap:"; 125 // for(DistanceMultiMap::iterator runner = DistanceMMap.begin(); runner != DistanceMMap.end(); runner++) { 126 // Log() << Verbose(0) << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")"; 127 // } 128 // Log() << Verbose(0) << endl; 124 // // listing distances 125 // if (DoLog(1)) { 126 // std::stringstream output; 127 // output << "Listing DistanceMMap:"; 128 // for(DistanceMultiMap::iterator runner = DistanceMMap.begin(); runner != DistanceMMap.end(); runner++) { 129 // output << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")"; 130 // } 131 // LOG(1, output.str()); 132 // } 129 133 // 4b2. pick three baselines forming a triangle 130 134 // 1. we take from the smallest sum of squared distance as the base line BC (with peak A) onward as the triangle candidate … … 137 141 baseline->second.first->second->node->getPosition(), 138 142 baseline->second.second->second->node->getPosition()).getNormal(); 139 DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);143 LOG(2, "Plane vector of candidate triangle is " << PlaneVector); 140 144 // 4. loop over all points 141 145 double sign = 0.; … … 150 154 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 151 155 continue; 152 DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->getName() << " yields distance of " << distance << "." << endl);156 LOG(2, "Projection of " << checker->second->node->getName() << " yields distance of " << distance << "."); 153 157 tmp = distance / fabs(distance); 154 158 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) 155 159 if ((sign != 0) && (tmp != sign)) { 156 160 // 4c. If so, break 4. loop and continue with next candidate in 1. loop 157 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leaves " << checker->second->node->getName() << " outside the convex hull." << endl);161 LOG(2, "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leaves " << checker->second->node->getName() << " outside the convex hull."); 158 162 break; 159 163 } else { // note the sign for later 160 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leave " << checker->second->node->getName() << " inside the convex hull." << endl);164 LOG(2, "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leave " << checker->second->node->getName() << " inside the convex hull."); 161 165 sign = tmp; 162 166 } … … 178 182 // 5. come this far, all on same side? Then break 1. loop and construct triangle 179 183 if (checker == PointsOnBoundary.end()) { 180 DoLog(2) && (Log() << Verbose(2) << "Looks like we have a candidate!" << endl);184 LOG(2, "Looks like we have a candidate!"); 181 185 break; 182 186 } … … 202 206 } 203 207 204 DoLog(1) && (Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl);208 LOG(1, "Starting triangle is " << *BTS << "."); 205 209 } else { 206 DoeLog(0) && (eLog() << Verbose(0) << "No starting triangle found." << endl);210 ELOG(0, "No starting triangle found."); 207 211 } 208 212 } … … 243 247 // get peak point with respect to this base line's only triangle 244 248 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 245 DoLog(0) && (Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl);249 LOG(0, "Current baseline is between " << *(baseline->second) << "."); 246 250 for (int i = 0; i < 3; i++) 247 251 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 248 252 peak = BTS->endpoints[i]; 249 DoLog(1) && (Log() << Verbose(1) << " and has peak " << *peak << "." << endl);253 LOG(1, " and has peak " << *peak << "."); 250 254 251 255 // prepare some auxiliary vectors … … 260 264 CenterVector += BTS->getEndpoint(i); 261 265 CenterVector.Scale(1. / 3.); 262 DoLog(2) && (Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl);266 LOG(2, "CenterVector of base triangle is " << CenterVector); 263 267 264 268 // normal vector of triangle … … 266 270 BTS->GetNormalVector(NormalVector); 267 271 NormalVector = BTS->NormalVector; 268 DoLog(2) && (Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl);272 LOG(2, "NormalVector of base triangle is " << NormalVector); 269 273 270 274 // vector in propagation direction (out of triangle) … … 272 276 PropagationVector = Plane(BaseLine, NormalVector,0).getNormal(); 273 277 TempVector = CenterVector - (baseline->second->endpoints[0]->node->getPosition()); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 274 //L og() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;278 //LOG(0, "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "."); 275 279 if (PropagationVector.ScalarProduct(TempVector) > 0) // make sure normal propagation vector points outward from baseline 276 280 PropagationVector.Scale(-1.); 277 DoLog(2) && (Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl);281 LOG(2, "PropagationVector of base triangle is " << PropagationVector); 278 282 winner = PointsOnBoundary.end(); 279 283 … … 281 285 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 282 286 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 283 DoLog(1) && (Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl);287 LOG(1, "Target point is " << *(target->second) << ":"); 284 288 285 289 // first check direction, so that triangles don't intersect … … 287 291 VirtualNormalVector.ProjectOntoPlane(NormalVector); 288 292 TempAngle = VirtualNormalVector.Angle(PropagationVector); 289 DoLog(2) && (Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl);293 LOG(2, "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "."); 290 294 if (TempAngle > (M_PI / 2.)) { // no bends bigger than Pi/2 (90 degrees) 291 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl);295 LOG(2, "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!"); 292 296 continue; 293 297 } else 294 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl);298 LOG(2, "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!"); 295 299 296 300 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 298 302 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 299 303 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 300 DoLog(2) && (Log() << Verbose(2) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl);304 LOG(2, *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles."); 301 305 continue; 302 306 } 303 307 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 304 DoLog(2) && (Log() << Verbose(2) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl);308 LOG(2, *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles."); 305 309 continue; 306 310 } … … 308 312 // check whether the envisaged triangle does not already exist (if both lines exist and have same endpoint) 309 313 if ((((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (GetCommonEndpoint(LineChecker[0]->second, LineChecker[1]->second) == peak)))) { 310 DoLog(4) && (Log() << Verbose(4) << "Current target is peak!" << endl);314 LOG(4, "Current target is peak!"); 311 315 continue; 312 316 } … … 317 321 helper.ProjectOntoPlane(TempVector); 318 322 if (fabs(helper.NormSquared()) < MYEPSILON) { 319 DoLog(2) && (Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl);323 LOG(2, "Chosen set of vectors is linear dependent."); 320 324 continue; 321 325 } … … 335 339 // calculate angle 336 340 TempAngle = NormalVector.Angle(VirtualNormalVector); 337 DoLog(2) && (Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl);341 LOG(2, "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "."); 338 342 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 339 343 SmallestAngle = TempAngle; 340 344 winner = target; 341 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);345 LOG(2, "New winner " << *winner->second->node << " due to smaller angle between normal vectors."); 342 346 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 343 347 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 354 358 SmallestAngle = TempAngle; 355 359 winner = target; 356 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl);360 LOG(2, "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction."); 357 361 } else 358 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl);362 LOG(2, "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction."); 359 363 } else 360 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);364 LOG(2, "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors."); 361 365 } 362 366 } // end of loop over all boundary points … … 364 368 // 5b. The point of the above whose triangle has the greatest angle with the triangle the current line belongs to (it only belongs to one, remember!): New triangle 365 369 if (winner != PointsOnBoundary.end()) { 366 DoLog(0) && (Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl);370 LOG(0, "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "."); 367 371 // create the lins of not yet present 368 372 BLS[0] = baseline->second; … … 394 398 TrianglesOnBoundaryCount++; 395 399 } else { 396 DoeLog(2) && (eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl);400 ELOG(2, "I could not determine a winner for this baseline " << *(baseline->second) << "."); 397 401 } 398 402 399 403 // 5d. If the set of lines is not yet empty, go to 5. and continue 400 404 } else 401 DoLog(0) && (Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl);405 LOG(0, "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "."); 402 406 } while (flag); 403 407 … … 434 438 } 435 439 Walker = cloud.GetPoint(); 436 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);440 LOG(0, "Current point is " << *Walker << "."); 437 441 // get the next triangle 438 442 triangles = FindClosestTrianglesToVector(Walker->getPosition(), BoundaryPoints); … … 443 447 delete triangles; 444 448 if ((BTS == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 445 DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl);449 LOG(0, "No triangles found, probably a tesselation point itself."); 446 450 cloud.GoToNext(); 447 451 continue; 448 452 } else { 449 453 } 450 DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);454 LOG(0, "Closest triangle is " << *BTS << "."); 451 455 // get the intersection point 452 456 if (BTS->GetIntersectionInsideTriangle(*Center, Walker->getPosition(), Intersection)) { 453 DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);457 LOG(0, "We have an intersection at " << Intersection << "."); 454 458 // we have the intersection, check whether in- or outside of boundary 455 459 if ((Center->DistanceSquared(Walker->getPosition()) - Center->DistanceSquared(Intersection)) < -MYEPSILON) { 456 460 // inside, next! 457 DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);461 LOG(0, *Walker << " is inside wrt triangle " << *BTS << "."); 458 462 } else { 459 463 // outside! 460 DoLog(0) && (Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl);464 LOG(0, *Walker << " is outside wrt triangle " << *BTS << "."); 461 465 class BoundaryLineSet *OldLines[3], *NewLines[3]; 462 466 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 468 472 Normal = BTS->NormalVector; 469 473 // add Walker to boundary points 470 DoLog(0) && (Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl);474 LOG(0, "Adding " << *Walker << " to BoundaryPoints."); 471 475 AddFlag = true; 472 476 if (AddBoundaryPoint(Walker, 0)) … … 475 479 continue; 476 480 // remove triangle 477 DoLog(0) && (Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl);481 LOG(0, "Erasing triangle " << *BTS << "."); 478 482 TrianglesOnBoundary.erase(BTS->Nr); 479 483 delete (BTS); … … 483 487 BPS[1] = OldPoints[i]; 484 488 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 485 DoLog(1) && (Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl);489 LOG(1, "Creating new line " << *NewLines[i] << "."); 486 490 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 487 491 LinesOnBoundaryCount++; … … 494 498 if (NewLines[j]->IsConnectedTo(BLS[0])) { 495 499 if (n > 2) { 496 DoeLog(2) && (eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl);500 ELOG(2, BLS[0] << " connects to all of the new lines?!"); 497 501 return false; 498 502 } else … … 505 509 BTS->GetNormalVector(Normal); 506 510 Normal.Scale(-1.); 507 DoLog(0) && (Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl);511 LOG(0, "Created new triangle " << *BTS << "."); 508 512 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 509 513 TrianglesOnBoundaryCount++; … … 511 515 } 512 516 } else { // something is wrong with FindClosestTriangleToPoint! 513 DoeLog(1) && (eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl);517 ELOG(1, "The closest triangle did not produce an intersection!"); 514 518 SuccessFlag = false; 515 519 break; … … 562 566 } else { 563 567 delete TPS[n]; 564 DoLog(0) && (Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl);568 LOG(0, "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary."); 565 569 TPS[n] = (InsertUnique.first)->second; 566 570 } … … 599 603 BoundaryLineSet *WinningLine = NULL; 600 604 if (FindLine != a->lines.end()) { 601 DoLog(1) && (Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl);605 LOG(1, "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "."); 602 606 603 607 pair<LineMap::iterator, LineMap::iterator> FindPair; … … 605 609 606 610 for (FindLine = FindPair.first; (FindLine != FindPair.second) && (insertNewLine); FindLine++) { 607 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);611 LOG(1, "INFO: Checking line " << *(FindLine->second) << " ..."); 608 612 // If there is a line with less than two attached triangles, we don't need a new line. 609 613 if (FindLine->second->triangles.size() == 1) { 610 614 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 611 615 if (!Finder->second->pointlist.empty()) 612 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);616 LOG(1, "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "."); 613 617 else 614 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl);618 LOG(1, "INFO: line " << *(FindLine->second) << " is open with no candidate."); 615 619 // get open line 616 620 for (TesselPointList::const_iterator CandidateChecker = Finder->second->pointlist.begin(); CandidateChecker != Finder->second->pointlist.end(); ++CandidateChecker) { 617 621 if ((*(CandidateChecker) == candidate->node) && (OptCenter == NULL || OptCenter->DistanceSquared(Finder->second->OptCenter) < MYEPSILON )) { // stop searching if candidate matches 618 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Candidate " << *(*CandidateChecker) << " has the right center " << Finder->second->OptCenter << "." << endl);622 LOG(1, "ACCEPT: Candidate " << *(*CandidateChecker) << " has the right center " << Finder->second->OptCenter << "."); 619 623 insertNewLine = false; 620 624 WinningLine = FindLine->second; 621 625 break; 622 626 } else { 623 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *(*CandidateChecker) << "'s center " << Finder->second->OptCenter << " does not match desired on " << *OptCenter << "." << endl);627 LOG(1, "REJECT: Candidate " << *(*CandidateChecker) << "'s center " << Finder->second->OptCenter << " does not match desired on " << *OptCenter << "."); 624 628 } 625 629 } … … 647 651 { 648 652 Info FunctionInfo(__func__); 649 DoLog(0) && (Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl);653 LOG(0, "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "."); 650 654 BPS[0] = a; 651 655 BPS[1] = b; … … 669 673 { 670 674 Info FunctionInfo(__func__); 671 DoLog(0) && (Log() << Verbose(0) << "Using existing line " << *Line << endl);675 LOG(0, "Using existing line " << *Line); 672 676 673 677 // set endpoints and line … … 678 682 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 679 683 if (CandidateLine != OpenLines.end()) { 680 DoLog(1) && (Log() << Verbose(1) << " Removing line from OpenLines." << endl);684 LOG(1, " Removing line from OpenLines."); 681 685 delete (CandidateLine->second); 682 686 OpenLines.erase(CandidateLine); 683 687 } else { 684 DoeLog(1) && (eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl);688 ELOG(1, "Line exists and is attached to less than two triangles, but not in OpenLines!"); 685 689 } 686 690 } … … 693 697 { 694 698 Info FunctionInfo(__func__); 695 DoLog(1) && (Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl);699 LOG(1, "Adding triangle to global TrianglesOnBoundary map."); 696 700 697 701 // add triangle to global map … … 713 717 { 714 718 Info FunctionInfo(__func__); 715 DoLog(0) && (Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl);719 LOG(0, "Adding triangle to global TrianglesOnBoundary map."); 716 720 717 721 // add triangle to global map … … 737 741 for (int i = 0; i < 3; i++) { 738 742 if (triangle->lines[i] != NULL) { 739 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl);743 LOG(0, "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "."); 740 744 triangle->lines[i]->triangles.erase(triangle->Nr); 745 std::stringstream output; 746 output << "INFO: " << *triangle->lines[i] << " is "; 741 747 if (triangle->lines[i]->triangles.empty()) { 742 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl);748 output << "no more attached to any triangle, erasing."; 743 749 RemoveTesselationLine(triangle->lines[i]); 744 750 } else { 745 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: " << endl);751 output << "still attached to another triangle: "; 746 752 OpenLines.insert(pair<BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL)); 747 753 for (TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 748 DoLog(0) && (Log() << Verbose(0) << "\t[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"); 749 DoLog(0) && (Log() << Verbose(0) << endl); 750 // for (int j=0;j<2;j++) { 751 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 752 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 753 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; 754 // Log() << Verbose(0) << endl; 755 // } 754 output << "\t[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 756 755 } 756 LOG(1, output.str()); 757 757 triangle->lines[i] = NULL; // free'd or not: disconnect 758 758 } else 759 DoeLog(1) && (eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl);759 ELOG(1, "This line " << i << " has already been free'd."); 760 760 } 761 761 762 762 if (TrianglesOnBoundary.erase(triangle->Nr)) 763 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl);763 LOG(0, "Removing triangle Nr. " << triangle->Nr << "."); 764 764 delete (triangle); 765 765 } … … 793 793 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 794 794 if ((*Runner).second == line) { 795 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);795 LOG(0, "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "."); 796 796 line->endpoints[i]->lines.erase(Runner); 797 797 break; … … 799 799 } else { // there's just a single line left 800 800 if (line->endpoints[i]->lines.erase(line->Nr)) 801 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);801 LOG(0, "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "."); 802 802 } 803 803 if (line->endpoints[i]->lines.empty()) { 804 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl);804 LOG(0, *line->endpoints[i] << " has no more lines it's attached to, erasing."); 805 805 RemoveTesselationPoint(line->endpoints[i]); 806 } else { 807 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "); 806 } else if (DoLog(0)) { 807 std::stringstream output; 808 output << *line->endpoints[i] << " has still lines it's attached to: "; 808 809 for (LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 809 DoLog(0) && (Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t");810 DoLog(0) && (Log() << Verbose(0) << endl);810 output << "[" << *(LineRunner->second) << "] \t"; 811 LOG(0, output.str()); 811 812 } 812 813 line->endpoints[i] = NULL; // free'd or not: disconnect 813 814 } else 814 DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl);815 ELOG(1, "Endpoint " << i << " has already been free'd."); 815 816 } 816 817 if (!line->triangles.empty()) 817 DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl);818 ELOG(2, "Memory Leak! I " << *line << " am still connected to some triangles."); 818 819 819 820 if (LinesOnBoundary.erase(line->Nr)) 820 DoLog(0) && (Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl);821 LOG(0, "Removing line Nr. " << line->Nr << "."); 821 822 delete (line); 822 823 } … … 834 835 return; 835 836 if (PointsOnBoundary.erase(point->Nr)) 836 DoLog(0) && (Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl);837 LOG(0, "Removing point Nr. " << point->Nr << "."); 837 838 delete (point); 838 839 } … … 851 852 Info FunctionInfo(__func__); 852 853 853 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);854 LOG(1, "INFO: Checking whether sphere contains no others points ..."); 854 855 bool flag = true; 855 856 856 DoLog(1) && (Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter[0] << " " << CandidateLine.OtherOptCenter[1] << " " << CandidateLine.OtherOptCenter[2] << "} radius " << RADIUS << " resolution 30" << endl);857 LOG(1, "Check by: draw sphere {" << CandidateLine.OtherOptCenter[0] << " " << CandidateLine.OtherOptCenter[1] << " " << CandidateLine.OtherOptCenter[2] << "} radius " << RADIUS << " resolution 30"); 857 858 // get all points inside the sphere 858 859 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, &CandidateLine.OtherOptCenter); 859 860 860 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);861 LOG(1, "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":"); 861 862 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 862 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);863 LOG(1, " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "."); 863 864 864 865 // remove triangles's endpoints … … 872 873 // check for other points 873 874 if (!ListofPoints->empty()) { 874 DoLog(1) && (Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl);875 LOG(1, "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere."); 875 876 flag = false; 876 DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);877 LOG(1, "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":"); 877 878 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 878 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);879 LOG(1, " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "."); 879 880 } 880 881 delete (ListofPoints); … … 917 918 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->getNr()); FindLine++) { 918 919 TriangleMap *triangles = &FindLine->second->triangles; 919 DoLog(1) && (Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl);920 LOG(1, "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "."); 920 921 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 921 922 if (FindTriangle->second->IsPresentTupel(Points)) { … … 923 924 } 924 925 } 925 DoLog(1) && (Log() << Verbose(1) << "end." << endl);926 LOG(1, "end."); 926 927 } 927 928 // Only one of the triangle lines must be considered for the triangle count. 928 //L og() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;929 //LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 929 930 //return adjacentTriangleCount; 930 931 } … … 933 934 } 934 935 935 DoLog(0) && (Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl);936 LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 936 937 return adjacentTriangleCount; 937 938 } … … 978 979 } 979 980 // Only one of the triangle lines must be considered for the triangle count. 980 //L og() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;981 //LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 981 982 //return adjacentTriangleCount; 982 983 } … … 1028 1029 for (LC->n[map[2]] = 0; LC->n[map[2]] < LC->N[map[2]]; LC->n[map[2]]++) { 1029 1030 const TesselPointSTLList *List = LC->GetCurrentCell(); 1030 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1031 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 1031 1032 if (List != NULL) { 1032 1033 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 1033 1034 if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) { 1034 DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl);1035 LOG(1, "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "."); 1035 1036 maxCoordinate[map[0]] = (*Runner)->at(map[0]); 1036 1037 MaxPoint[map[0]] = (*Runner); … … 1038 1039 } 1039 1040 } else { 1040 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);1041 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 1041 1042 } 1042 1043 } 1043 1044 } 1044 1045 1045 DoLog(1) && (Log() << Verbose(1) << "Found maximum coordinates: "); 1046 for (int i = 0; i < NDIM; i++) 1047 DoLog(0) && (Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"); 1048 DoLog(0) && (Log() << Verbose(0) << endl); 1046 if (DoLog(1)) { 1047 std::stringstream output; 1048 output << "Found maximum coordinates: "; 1049 for (int i = 0; i < NDIM; i++) 1050 output << i << ": " << *MaxPoint[i] << "\t"; 1051 LOG(1, output.str()); 1052 } 1049 1053 1050 1054 BTS = NULL; … … 1054 1058 BaseLine = new BoundaryLineSet(); 1055 1059 BaseLine->endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 1056 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);1060 LOG(0, "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "."); 1057 1061 1058 1062 double ShortestAngle; … … 1088 1092 1089 1093 // adding point 1 and point 2 and add the line between them 1090 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);1091 DoLog(0) && (Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n");1092 1093 //L og() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";1094 LOG(0, "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "."); 1095 LOG(0, "Found second point is at " << *BaseLine->endpoints[1]->node << "."); 1096 1097 //LOG(1, "INFO: OldSphereCenter is at " << helper << "."); 1094 1098 CandidateForTesselation OptCandidates(BaseLine); 1095 1099 FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC); 1096 DoLog(0) && (Log() << Verbose(0) << "List of third Points is:" << endl);1100 LOG(0, "List of third Points is:"); 1097 1101 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 1098 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);1102 LOG(0, " " << *(*it)); 1099 1103 } 1100 1104 if (!OptCandidates.pointlist.empty()) { … … 1150 1154 // if (FindLine != (FindPoint->second)->lines.end()) { 1151 1155 // Line = FindLine->second; 1152 // L og() << Verbose(0) << "Found line " << *Line << "." << endl;1156 // LOG(0, "Found line " << *Line << "."); 1153 1157 // if (Line->triangles.size() == 1) { 1154 1158 // T = Line->triangles.begin()->second; … … 1167 1171 // CircleRadius = RADIUS*RADIUS - radius/4.; 1168 1172 // CirclePlaneNormal.Normalize(); 1169 // //L og() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;1173 // //LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 1170 1174 // 1171 1175 // // construct old center … … 1176 1180 // OldSphereCenter.AddVector(&helper); 1177 1181 // OldSphereCenter.SubtractVector(&CircleCenter); 1178 // //L og() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;1182 // //LOG(1, "INFO: OldSphereCenter is at " << OldSphereCenter << "."); 1179 1183 // 1180 1184 // // construct SearchDirection … … 1186 1190 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1187 1191 // SearchDirection.Normalize(); 1188 // L og() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;1192 // LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 1189 1193 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1190 1194 // // rotated the wrong way! 1191 // DoeLog(1) && (eLog()<< Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);1195 // ELOG(1, "SearchDirection and RelativeOldSphereCenter are still not orthogonal!"); 1192 1196 // } 1193 1197 // … … 1197 1201 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1198 1202 // continue; 1199 // L og() << Verbose(0) << "Third point candidate is " << (*it)1200 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;1201 // L og() << Verbose(0) << " Baseline is " << *BaseRay << endl;1203 // LOG(1, "INFO: Third point candidate is " << (*it) 1204 // << " with circumsphere's center at " << (*it)->OptCenter << "."); 1205 // LOG(1, "INFO: Baseline is " << *BaseRay); 1202 1206 // 1203 1207 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) … … 1233 1237 // if (check) { 1234 1238 // if (ShortestAngle > OtherShortestAngle) { 1235 // L og() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;1239 // LOG(0, "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "."); 1236 1240 // result = true; 1237 1241 // break; … … 1243 1247 // break; 1244 1248 // } else { 1245 // L og() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;1249 // LOG(0, "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!"); 1246 1250 // } 1247 1251 // } else { 1248 // DoeLog(2) && (eLog()<< Verbose(2) << "Baseline is connected to two triangles already?" << endl);1252 // ELOG(2, "Baseline is connected to two triangles already?"); 1249 1253 // } 1250 1254 // } else { 1251 // L og() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;1255 // LOG(1, "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "."); 1252 1256 // } 1253 1257 // } 1254 1258 // } else { 1255 // DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl);1259 // ELOG(1, "Could not find the TesselPoint " << *ThirdNode << "."); 1256 1260 // } 1257 1261 // … … 1284 1288 break; 1285 1289 } 1286 DoLog(0) && (Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl);1290 LOG(0, "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "."); 1287 1291 1288 1292 CandidateLine.T = &T; … … 1304 1308 CircleRadius = RADIUS * RADIUS - radius / 4.; 1305 1309 CirclePlaneNormal.Normalize(); 1306 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);1307 1308 DoLog(1) && (Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl);1310 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 1311 1312 LOG(1, "INFO: OldSphereCenter is at " << T.SphereCenter << "."); 1309 1313 1310 1314 // construct SearchDirection and an "outward pointer" … … 1313 1317 if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1314 1318 SearchDirection.Scale(-1.); 1315 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);1319 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 1316 1320 if (fabs(RelativeSphereCenter.ScalarProduct(SearchDirection)) > HULLEPSILON) { 1317 1321 // rotated the wrong way! 1318 DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);1322 ELOG(1, "SearchDirection and RelativeOldSphereCenter are still not orthogonal!"); 1319 1323 } 1320 1324 … … 1323 1327 1324 1328 } else { 1325 DoLog(0) && (Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl);1329 LOG(0, "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!"); 1326 1330 } 1327 1331 1328 1332 if (CandidateLine.pointlist.empty()) { 1329 DoeLog(2) && (eLog() << Verbose(2) << "Could not find a suitable candidate." << endl);1333 ELOG(2, "Could not find a suitable candidate."); 1330 1334 return false; 1331 1335 } 1332 DoLog(0) && (Log() << Verbose(0) << "Third Points are: " << endl);1336 LOG(0, "Third Points are: "); 1333 1337 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 1334 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);1338 LOG(0, " " << *(*it)); 1335 1339 } 1336 1340 … … 1356 1360 ASSERT((baseline->BaseLine->triangles.size() == 1),"Open line without exactly one attached triangle"); 1357 1361 T = (((baseline->BaseLine->triangles.begin()))->second); 1358 DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);1362 LOG(1, "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T); 1359 1363 TesselationFailFlag = TesselationFailFlag && FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1360 1364 } … … 1387 1391 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->getPosition()); 1388 1392 1389 DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);1393 LOG(0, "List of Candidates for Turning Point " << *TurningPoint << ":"); 1390 1394 for (TesselPointList::iterator TesselRunner = connectedClosestPoints->begin(); TesselRunner != connectedClosestPoints->end(); ++TesselRunner) 1391 DoLog(0) && (Log() << Verbose(0) << " " << **TesselRunner << endl);1395 LOG(0, " " << **TesselRunner); 1392 1396 1393 1397 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) … … 1396 1400 Sprinter++; 1397 1401 while (Sprinter != connectedClosestPoints->end()) { 1398 DoLog(0) && (Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl);1402 LOG(0, "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "."); 1399 1403 1400 1404 AddTesselationPoint(TurningPoint, 0); … … 1409 1413 // fill the internal open lines with its respective candidate (otherwise lines in degenerate case are not picked) 1410 1414 FindDegeneratedCandidatesforOpenLines(*Sprinter, &CandidateLine.OptCenter); // Assume BTS contains last triangle 1411 DoLog(0) && (Log() << Verbose(0) << " There are still more triangles to add." << endl);1415 LOG(0, " There are still more triangles to add."); 1412 1416 } 1413 1417 // pick candidates for other open lines as well … … 1417 1421 if (CheckDegeneracy(CandidateLine, RADIUS, LC)) { 1418 1422 // add normal and degenerate triangles 1419 DoLog(1) && (Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl);1423 LOG(1, "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides."); 1420 1424 AddCandidateTriangle(CandidateLine, OtherOpt); 1421 1425 … … 1441 1445 pair<LineMap::iterator, LineMap::iterator> FindPair = TPS[0]->lines.equal_range(TPS[2]->node->getNr()); 1442 1446 for (LineMap::const_iterator FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { 1443 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);1447 LOG(1, "INFO: Checking line " << *(FindLine->second) << " ..."); 1444 1448 // If there is a line with less than two attached triangles, we don't need a new line. 1445 1449 if (FindLine->second->triangles.size() == 1) { 1446 1450 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 1447 1451 if (!Finder->second->pointlist.empty()) 1448 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);1452 LOG(1, "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "."); 1449 1453 else { 1450 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl);1454 LOG(1, "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter)); 1451 1455 Finder->second->T = BTS; // is last triangle 1452 1456 Finder->second->pointlist.push_back(Sprinter); … … 1473 1477 1474 1478 /// 1. Create or pick the lines for the first triangle 1475 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl);1479 LOG(0, "INFO: Creating/Picking lines for first triangle ..."); 1476 1480 for (int i = 0; i < 3; i++) { 1477 1481 BLS[i] = NULL; 1478 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1482 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1479 1483 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 1480 1484 } 1481 1485 1482 1486 /// 2. create the first triangle and NormalVector and so on 1483 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl);1487 LOG(0, "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..."); 1484 1488 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1485 1489 AddTesselationTriangle(); … … 1492 1496 // give some verbose output about the whole procedure 1493 1497 if (CandidateLine.T != NULL) 1494 DoLog(0) && (Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1498 LOG(0, "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1495 1499 else 1496 DoLog(0) && (Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1500 LOG(0, "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1497 1501 triangle = BTS; 1498 1502 1499 1503 /// 3. Gather candidates for each new line 1500 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl);1504 LOG(0, "INFO: Adding candidates to new lines ..."); 1501 1505 for (int i = 0; i < 3; i++) { 1502 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1506 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1503 1507 CandidateCheck = OpenLines.find(BLS[i]); 1504 1508 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 1510 1514 1511 1515 /// 4. Create or pick the lines for the second triangle 1512 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl);1516 LOG(0, "INFO: Creating/Picking lines for second triangle ..."); 1513 1517 for (int i = 0; i < 3; i++) { 1514 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1518 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1515 1519 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 1516 1520 } 1517 1521 1518 1522 /// 5. create the second triangle and NormalVector and so on 1519 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl);1523 LOG(0, "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..."); 1520 1524 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1521 1525 AddTesselationTriangle(); … … 1527 1531 // give some verbose output about the whole procedure 1528 1532 if (CandidateLine.T != NULL) 1529 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1533 LOG(0, "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1530 1534 else 1531 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1535 LOG(0, "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1532 1536 1533 1537 /// 6. Adding triangle to new lines 1534 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl);1538 LOG(0, "INFO: Adding second triangles to new lines ..."); 1535 1539 for (int i = 0; i < 3; i++) { 1536 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1540 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1537 1541 CandidateCheck = OpenLines.find(BLS[i]); 1538 1542 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 1572 1576 // give some verbose output about the whole procedure 1573 1577 if (CandidateLine.T != NULL) 1574 DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1578 LOG(0, "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1575 1579 else 1576 DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1580 LOG(0, "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1577 1581 } 1578 1582 ; … … 1599 1603 OtherBase = new class BoundaryLineSet(BPS, -1); 1600 1604 1601 DoLog(1) && (Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl);1602 DoLog(1) && (Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl);1605 LOG(1, "INFO: Current base line is " << *Base << "."); 1606 LOG(1, "INFO: Other base line is " << *OtherBase << "."); 1603 1607 1604 1608 // get the closest point on each line to the other line … … 1618 1622 delete (ClosestPoint); 1619 1623 if ((distance[0] * distance[1]) > 0) { // have same sign? 1620 DoLog(1) && (Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl);1624 LOG(1, "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave."); 1621 1625 if (distance[0] < distance[1]) { 1622 1626 Spot = Base->endpoints[0]; … … 1626 1630 return Spot; 1627 1631 } else { // different sign, i.e. we are in between 1628 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl);1632 LOG(0, "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex."); 1629 1633 return NULL; 1630 1634 } … … 1637 1641 Info FunctionInfo(__func__); 1638 1642 // print all lines 1639 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl);1643 LOG(0, "Printing all boundary points for debugging:"); 1640 1644 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin(); PointRunner != PointsOnBoundary.end(); PointRunner++) 1641 DoLog(0) && (Log() << Verbose(0) << *(PointRunner->second) << endl);1645 LOG(0, *(PointRunner->second)); 1642 1646 } 1643 1647 ; … … 1647 1651 Info FunctionInfo(__func__); 1648 1652 // print all lines 1649 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl);1653 LOG(0, "Printing all boundary lines for debugging:"); 1650 1654 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 1651 DoLog(0) && (Log() << Verbose(0) << *(LineRunner->second) << endl);1655 LOG(0, *(LineRunner->second)); 1652 1656 } 1653 1657 ; … … 1657 1661 Info FunctionInfo(__func__); 1658 1662 // print all triangles 1659 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl);1663 LOG(0, "Printing all boundary triangles for debugging:"); 1660 1664 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 1661 DoLog(0) && (Log() << Verbose(0) << *(TriangleRunner->second) << endl);1665 LOG(0, *(TriangleRunner->second)); 1662 1666 } 1663 1667 ; … … 1682 1686 OtherBase = new class BoundaryLineSet(BPS, -1); 1683 1687 1684 DoLog(0) && (Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl);1685 DoLog(0) && (Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl);1688 LOG(0, "INFO: Current base line is " << *Base << "."); 1689 LOG(0, "INFO: Other base line is " << *OtherBase << "."); 1686 1690 1687 1691 // get the closest point on each line to the other line … … 1701 1705 1702 1706 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 1703 DoLog(0) && (Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl);1707 LOG(0, "REJECT: Both lines have an intersection: Nothing to do."); 1704 1708 return false; 1705 1709 } else { // check for sign against BaseLineNormal … … 1707 1711 BaseLineNormal.Zero(); 1708 1712 if (Base->triangles.size() < 2) { 1709 DoeLog(1) && (eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);1713 ELOG(1, "Less than two triangles are attached to this baseline!"); 1710 1714 return 0.; 1711 1715 } 1712 1716 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 1713 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);1717 LOG(1, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "."); 1714 1718 BaseLineNormal += (runner->second->NormalVector); 1715 1719 } … … 1717 1721 1718 1722 if (Distance.ScalarProduct(BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 1719 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl);1723 LOG(0, "ACCEPT: Other base line would be higher: Flipping baseline."); 1720 1724 // calculate volume summand as a general tetraeder 1721 1725 return volume; 1722 1726 } else { // Base higher than OtherBase -> do nothing 1723 DoLog(0) && (Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl);1727 LOG(0, "REJECT: Base line is higher: Nothing to do."); 1724 1728 return 0.; 1725 1729 } … … 1747 1751 BaseLineNormal.Zero(); 1748 1752 if (Base->triangles.size() < 2) { 1749 DoeLog(1) && (eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);1753 ELOG(1, "Less than two triangles are attached to this baseline!"); 1750 1754 return NULL; 1751 1755 } 1752 1756 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 1753 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);1757 LOG(1, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "."); 1754 1758 BaseLineNormal += (runner->second->NormalVector); 1755 1759 } … … 1764 1768 i = 0; 1765 1769 m = 0; 1766 DoLog(0) && (Log() << Verbose(0) << "The four old lines are: "); 1770 1771 // print OldLines and OldPoints for debugging 1772 if (DoLog(0)) { 1773 std::stringstream output; 1774 output << "The four old lines are: "; 1775 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1776 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1777 if (runner->second->lines[j] != Base) // pick not the central baseline 1778 output << *runner->second->lines[j] << "\t"; 1779 LOG(0, output.str()); 1780 } 1781 if (DoLog(0)) { 1782 std::stringstream output; 1783 output << "The two old points are: "; 1784 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1785 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1786 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) // and neither of its endpoints 1787 output << *runner->second->endpoints[j] << "\t"; 1788 LOG(0, output.str()); 1789 } 1790 1791 // index OldLines and OldPoints 1767 1792 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1768 1793 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1769 if (runner->second->lines[j] != Base) {// pick not the central baseline1794 if (runner->second->lines[j] != Base) // pick not the central baseline 1770 1795 OldLines[i++] = runner->second->lines[j]; 1771 DoLog(0) && (Log() << Verbose(0) << *runner->second->lines[j] << "\t");1772 }1773 DoLog(0) && (Log() << Verbose(0) << endl);1774 DoLog(0) && (Log() << Verbose(0) << "The two old points are: ");1775 1796 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1776 1797 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1777 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) {// and neither of its endpoints1798 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) // and neither of its endpoints 1778 1799 OldPoints[m++] = runner->second->endpoints[j]; 1779 DoLog(0) && (Log() << Verbose(0) << *runner->second->endpoints[j] << "\t");1780 }1781 DoLog(0) && (Log() << Verbose(0) << endl);1782 1800 1783 1801 // check whether everything is in place to create new lines and triangles 1784 1802 if (i < 4) { 1785 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl);1803 ELOG(1, "We have not gathered enough baselines!"); 1786 1804 return NULL; 1787 1805 } 1788 1806 for (int j = 0; j < 4; j++) 1789 1807 if (OldLines[j] == NULL) { 1790 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl);1808 ELOG(1, "We have not gathered enough baselines!"); 1791 1809 return NULL; 1792 1810 } 1793 1811 for (int j = 0; j < 2; j++) 1794 1812 if (OldPoints[j] == NULL) { 1795 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl);1813 ELOG(1, "We have not gathered enough endpoints!"); 1796 1814 return NULL; 1797 1815 } 1798 1816 1799 1817 // remove triangles and baseline removes itself 1800 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl);1818 LOG(0, "INFO: Deleting baseline " << *Base << " from global list."); 1801 1819 OldBaseLineNr = Base->Nr; 1802 1820 m = 0; … … 1807 1825 // .. then delete each triangle (which deletes the line as well) 1808 1826 for (list <BoundaryTriangleSet *>::iterator runner = TrianglesOfBase.begin(); !TrianglesOfBase.empty(); runner = TrianglesOfBase.begin()) { 1809 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(*runner) << "." << endl);1827 LOG(0, "INFO: Deleting triangle " << *(*runner) << "."); 1810 1828 OldTriangleNrs[m++] = (*runner)->Nr; 1811 1829 RemoveTesselationTriangle((*runner)); … … 1818 1836 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 1819 1837 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 1820 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl);1838 LOG(0, "INFO: Created new baseline " << *NewLine << "."); 1821 1839 1822 1840 // construct new triangles with flipped baseline … … 1833 1851 BTS->GetNormalVector(BaseLineNormal); 1834 1852 AddTesselationTriangle(OldTriangleNrs[0]); 1835 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);1853 LOG(0, "INFO: Created new triangle " << *BTS << "."); 1836 1854 1837 1855 BLS[0] = (i == 2 ? OldLines[3] : OldLines[2]); … … 1841 1859 BTS->GetNormalVector(BaseLineNormal); 1842 1860 AddTesselationTriangle(OldTriangleNrs[1]); 1843 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);1861 LOG(0, "INFO: Created new triangle " << *BTS << "."); 1844 1862 } else { 1845 DoeLog(0) && (eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl);1863 ELOG(0, "The four old lines do not connect, something's utterly wrong here!"); 1846 1864 return NULL; 1847 1865 } … … 1874 1892 N[i] = LC->n[i]; 1875 1893 } else { 1876 DoeLog(1) && (eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl);1894 ELOG(1, "Point " << *a << " is not found in cell " << LC->index << "."); 1877 1895 return; 1878 1896 } … … 1882 1900 Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1; 1883 1901 } 1884 DoLog(0) && (Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl);1902 LOG(0, "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], "); 1885 1903 1886 1904 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) … … 1888 1906 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 1889 1907 const TesselPointSTLList *List = LC->GetCurrentCell(); 1890 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1908 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 1891 1909 if (List != NULL) { 1892 1910 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 1915 1933 angle = AngleCheck.Angle(Oben); 1916 1934 if (angle < Storage[0]) { 1917 //L og() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0],Storage[1]);1918 DoLog(1) && (Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n");1935 //LOG(1, "INFO: Old values of Storage is " << Storage[0] << ", " << Storage[1]); 1936 LOG(1, "INFO: Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << "."); 1919 1937 OptCandidate = Candidate; 1920 1938 Storage[0] = angle; 1921 //L og() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);1939 //LOG(1, "INFO: Changing something in Storage is " << Storage[0] << ", " << Storage[1]); 1922 1940 } else { 1923 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;1941 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate); 1924 1942 } 1925 1943 } else { 1926 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;1944 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Refused due to Radius " << norm); 1927 1945 } 1928 1946 } else { 1929 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;1947 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "."); 1930 1948 } 1931 1949 } 1932 1950 } else { 1933 DoLog(0) && (Log() << Verbose(0) << "Linked cell list is empty." << endl);1951 LOG(0, "Linked cell list is empty."); 1934 1952 } 1935 1953 } … … 1986 2004 TesselPoint *Candidate = NULL; 1987 2005 1988 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl);2006 LOG(1, "INFO: NormalVector of BaseTriangle is " << NormalVector << "."); 1989 2007 1990 2008 // copy old center … … 2008 2026 CircleRadius = RADIUS * RADIUS - radius; 2009 2027 CirclePlaneNormal.Normalize(); 2010 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);2028 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 2011 2029 2012 2030 // test whether old center is on the band's plane 2013 2031 if (fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) > HULLEPSILON) { 2014 DoeLog(1) && (eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) << "!" << endl);2032 ELOG(1, "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) << "!"); 2015 2033 RelativeOldSphereCenter.ProjectOntoPlane(CirclePlaneNormal); 2016 2034 } 2017 2035 radius = RelativeOldSphereCenter.NormSquared(); 2018 2036 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2019 DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl);2037 LOG(1, "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "."); 2020 2038 2021 2039 // check SearchDirection 2022 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);2040 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 2023 2041 if (fabs(RelativeOldSphereCenter.ScalarProduct(SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2024 DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl);2042 ELOG(1, "SearchDirection and RelativeOldSphereCenter are not orthogonal!"); 2025 2043 } 2026 2044 … … 2029 2047 for (int i = 0; i < NDIM; i++) // store indices of this cell 2030 2048 N[i] = LC->n[i]; 2031 //L og() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2049 //LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 2032 2050 } else { 2033 DoeLog(1) && (eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl);2051 ELOG(1, "Vector " << CircleCenter << " is outside of LinkedCell's bounding box."); 2034 2052 return; 2035 2053 } 2036 2054 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2037 //Log() << Verbose(1) << "LC Intervals:"; 2055 // if (DoLog(0)) { 2056 // std::stringstream output; 2057 // output << "LC Intervals:"; 2058 // for (int i = 0; i < NDIM; i++) 2059 // output << " [" << Nlower[i] << "," << Nupper[i] << "] "; 2060 // LOG(0, output.str()); 2061 // } 2038 2062 for (int i = 0; i < NDIM; i++) { 2039 2063 Nlower[i] = ((N[i] - 1) >= 0) ? N[i] - 1 : 0; 2040 2064 Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1; 2041 //Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";2042 2065 } 2043 //Log() << Verbose(0) << endl;2044 2066 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 2045 2067 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2046 2068 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2047 2069 const TesselPointSTLList *List = LC->GetCurrentCell(); 2048 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2070 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 2049 2071 if (List != NULL) { 2050 2072 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2052 2074 2053 2075 // check for three unique points 2054 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl);2076 LOG(2, "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "."); 2055 2077 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node)) { 2056 2078 2057 2079 // find center on the plane 2058 2080 GetCenterofCircumcircle(NewPlaneCenter, CandidateLine.BaseLine->endpoints[0]->node->getPosition(), CandidateLine.BaseLine->endpoints[1]->node->getPosition(), Candidate->getPosition()); 2059 DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);2081 LOG(1, "INFO: NewPlaneCenter is " << NewPlaneCenter << "."); 2060 2082 2061 2083 try { … … 2063 2085 (CandidateLine.BaseLine->endpoints[1]->node->getPosition()), 2064 2086 (Candidate->getPosition())).getNormal(); 2065 DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);2087 LOG(1, "INFO: NewNormalVector is " << NewNormalVector << "."); 2066 2088 radius = CandidateLine.BaseLine->endpoints[0]->node->DistanceSquared(NewPlaneCenter); 2067 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);2068 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);2069 DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);2089 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 2090 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 2091 LOG(1, "INFO: Radius of CircumCenterCircle is " << radius << "."); 2070 2092 if (radius < RADIUS * RADIUS) { 2071 2093 otherradius = CandidateLine.BaseLine->endpoints[1]->node->DistanceSquared(NewPlaneCenter); … … 2076 2098 helper = NewNormalVector; 2077 2099 helper.Scale(sqrt(RADIUS * RADIUS - radius)); 2078 DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl);2100 LOG(2, "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "."); 2079 2101 NewSphereCenter += helper; 2080 DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl);2102 LOG(2, "INFO: NewSphereCenter is at " << NewSphereCenter << "."); 2081 2103 // OtherNewSphereCenter is created by the same vector just in the other direction 2082 2104 helper.Scale(-1.); 2083 2105 OtherNewSphereCenter += helper; 2084 DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);2106 LOG(2, "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "."); 2085 2107 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON); 2086 2108 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON); … … 2103 2125 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2104 2126 CandidateLine.pointlist.push_back(Candidate); 2105 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);2127 LOG(0, "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "."); 2106 2128 } else { 2107 2129 // remove all candidates from the list and then the list itself 2108 2130 CandidateLine.pointlist.clear(); 2109 2131 CandidateLine.pointlist.push_back(Candidate); 2110 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);2132 LOG(0, "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "."); 2111 2133 } 2112 2134 CandidateLine.ShortestAngle = alpha; 2113 DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);2135 LOG(0, "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now."); 2114 2136 } else { 2115 2137 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2116 DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl);2138 LOG(1, "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ."); 2117 2139 } else { 2118 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl);2140 LOG(1, "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected."); 2119 2141 } 2120 2142 } 2121 2143 } else { 2122 DoeLog(0) && (eLog() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl);2144 ELOG(0, "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius)); 2123 2145 } 2124 2146 } else { 2125 DoLog(1) && (Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl);2147 LOG(1, "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "."); 2126 2148 } 2127 2149 } 2128 2150 catch (LinearDependenceException &excp){ 2129 L og() << Verbose(1) << boost::diagnostic_information(excp);2130 L og() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2151 LOG(1, boost::diagnostic_information(excp)); 2152 LOG(1, "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent."); 2131 2153 } 2132 2154 } else { 2133 2155 if (ThirdPoint != NULL) { 2134 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl);2156 LOG(1, "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "."); 2135 2157 } else { 2136 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl);2158 LOG(1, "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "."); 2137 2159 } 2138 2160 } … … 2141 2163 } 2142 2164 } else { 2143 DoeLog(1) && (eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);2165 ELOG(1, "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "."); 2144 2166 } 2145 2167 } else { 2146 2168 if (ThirdPoint != NULL) 2147 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl);2169 LOG(1, "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!"); 2148 2170 else 2149 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl);2150 } 2151 2152 DoLog(1) && (Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl);2171 LOG(1, "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!"); 2172 } 2173 2174 LOG(1, "INFO: Sorting candidate list ..."); 2153 2175 if (CandidateLine.pointlist.size() > 1) { 2154 2176 CandidateLine.pointlist.unique(); … … 2157 2179 2158 2180 if ((!CandidateLine.pointlist.empty()) && (!CandidateLine.CheckValidity(RADIUS, LC))) { 2159 DoeLog(0) && (eLog() << Verbose(0) << "There were other points contained in the rolling sphere as well!" << endl);2181 ELOG(0, "There were other points contained in the rolling sphere as well!"); 2160 2182 performCriticalExit(); 2161 2183 } … … 2181 2203 if (!OrderTest.second) { // if insertion fails, we have common endpoint 2182 2204 node = OrderTest.first->second; 2183 DoLog(1) && (Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl);2205 LOG(1, "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "."); 2184 2206 j = 2; 2185 2207 i = 2; … … 2203 2225 2204 2226 if (LinesOnBoundary.empty()) { 2205 DoeLog(1) && (eLog() << Verbose(1) << "There is no tesselation structure to compare the point with, please create one first." << endl);2227 ELOG(1, "There is no tesselation structure to compare the point with, please create one first."); 2206 2228 return NULL; 2207 2229 } … … 2211 2233 for (int i = 0; i < NDIM; i++) // store indices of this cell 2212 2234 N[i] = LC->n[i]; 2213 DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);2235 LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 2214 2236 DistanceToPointMap * points = new DistanceToPointMap; 2215 2237 LC->GetNeighbourBounds(Nlower, Nupper); 2216 //Log() << Verbose(1) << endl;2217 2238 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 2218 2239 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2219 2240 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2220 2241 const TesselPointSTLList *List = LC->GetCurrentCell(); 2221 //L og() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;2242 //LOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2]); 2222 2243 if (List != NULL) { 2223 2244 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2225 2246 if (FindPoint != PointsOnBoundary.end()) { 2226 2247 points->insert(DistanceToPointPair(FindPoint->second->node->DistanceSquared(x), FindPoint->second)); 2227 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);2248 LOG(1, "INFO: Putting " << *FindPoint->second << " into the list."); 2228 2249 } 2229 2250 } 2230 2251 } else { 2231 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);2252 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 2232 2253 } 2233 2254 } … … 2235 2256 // check whether we found some points 2236 2257 if (points->empty()) { 2237 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2258 ELOG(1, "There is no nearest point: too far away from the surface."); 2238 2259 delete (points); 2239 2260 return NULL; … … 2254 2275 DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x, LC); 2255 2276 if (points == NULL) { 2256 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2277 ELOG(1, "There is no nearest point: too far away from the surface."); 2257 2278 return NULL; 2258 2279 } 2259 2280 2260 2281 // for each point, check its lines, remember closest 2261 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << x << " ... " << endl);2282 LOG(1, "Finding closest BoundaryLine to " << x << " ... "); 2262 2283 BoundaryLineSet *ClosestLine = NULL; 2263 2284 double MinDistance = -1.; … … 2284 2305 ClosestLine = LineRunner->second; 2285 2306 MinDistance = distance; 2286 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl);2307 LOG(1, "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "."); 2287 2308 } else { 2288 DoLog(1) && (Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl);2309 LOG(1, "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "."); 2289 2310 } 2290 2311 } else { 2291 DoLog(1) && (Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl);2312 LOG(1, "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "."); 2292 2313 } 2293 2314 } … … 2296 2317 // check whether closest line is "too close" :), then it's inside 2297 2318 if (ClosestLine == NULL) { 2298 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);2319 LOG(0, "Is the only point, no one else is closeby."); 2299 2320 return NULL; 2300 2321 } … … 2314 2335 DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x, LC); 2315 2336 if (points == NULL) { 2316 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2337 ELOG(1, "There is no nearest point: too far away from the surface."); 2317 2338 return NULL; 2318 2339 } 2319 2340 2320 2341 // for each point, check its lines, remember closest 2321 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << x << " ... " << endl);2342 LOG(1, "Finding closest BoundaryTriangle to " << x << " ... "); 2322 2343 LineSet ClosestLines; 2323 2344 double MinDistance = 1e+16; … … 2345 2366 ClosestLines.insert(LineRunner->second); 2346 2367 MinDistance = lengthEnd; 2347 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl);2368 LOG(1, "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "."); 2348 2369 } else if (fabs(lengthEnd - MinDistance) < MYEPSILON) { // additional best candidate 2349 2370 ClosestLines.insert(LineRunner->second); 2350 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl);2371 LOG(1, "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "."); 2351 2372 } else { // line is worse 2352 DoLog(1) && (Log() << Verbose(1) << "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "." << endl);2373 LOG(1, "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "."); 2353 2374 } 2354 2375 } else { // intersection is closer, calculate … … 2360 2381 const double distance = BaseLineIntersection.NormSquared(); 2361 2382 if (Center.NormSquared() > BaseLine.NormSquared()) { 2362 DoeLog(0) && (eLog() << Verbose(0) << "Algorithmic error: In second case we have intersection outside of baseline!" << endl);2383 ELOG(0, "Algorithmic error: In second case we have intersection outside of baseline!"); 2363 2384 } 2364 2385 if ((ClosestLines.empty()) || (distance < MinDistance)) { 2365 2386 ClosestLines.insert(LineRunner->second); 2366 2387 MinDistance = distance; 2367 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl);2388 LOG(1, "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "."); 2368 2389 } else { 2369 DoLog(2) && (Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl);2390 LOG(2, "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "."); 2370 2391 } 2371 2392 } … … 2376 2397 // check whether closest line is "too close" :), then it's inside 2377 2398 if (ClosestLines.empty()) { 2378 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);2399 LOG(0, "Is the only point, no one else is closeby."); 2379 2400 return NULL; 2380 2401 } … … 2416 2437 result = *Runner; 2417 2438 MinAlignment = Alignment; 2418 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl);2439 LOG(1, "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "."); 2419 2440 } else { 2420 DoLog(1) && (Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl);2441 LOG(1, "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "."); 2421 2442 } 2422 2443 } … … 2471 2492 2472 2493 if (triangle == NULL) {// is boundary point or only point in point cloud? 2473 DoLog(1) && (Log() << Verbose(1) << "No triangle given!" << endl);2494 LOG(1, "No triangle given!"); 2474 2495 return -1.; 2475 2496 } else { 2476 DoLog(1) && (Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl);2497 LOG(1, "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "."); 2477 2498 } 2478 2499 2479 2500 triangle->GetCenter(Center); 2480 DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);2501 LOG(2, "INFO: Central point of the triangle is " << Center << "."); 2481 2502 DistanceToCenter = Center - Point; 2482 DoLog(2) && (Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl);2503 LOG(2, "INFO: Vector from point to test to center is " << DistanceToCenter << "."); 2483 2504 2484 2505 // check whether we are on boundary … … 2487 2508 DistanceToCenter = Point + triangle->NormalVector; // points outside 2488 2509 Center = Point - triangle->NormalVector; // points towards MolCenter 2489 DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);2510 LOG(1, "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "."); 2490 2511 if (triangle->GetIntersectionInsideTriangle(Center, DistanceToCenter, Intersection)) { 2491 DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);2512 LOG(1, Point << " is inner point: sufficiently close to boundary, " << Intersection << "."); 2492 2513 return 0.; 2493 2514 } else { 2494 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl);2515 LOG(1, Point << " is NOT an inner point: on triangle plane but outside of triangle bounds."); 2495 2516 return false; 2496 2517 } … … 2498 2519 // calculate smallest distance 2499 2520 distance = triangle->GetClosestPointInsideTriangle(Point, Intersection); 2500 DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);2521 LOG(1, "Closest point on triangle is " << Intersection << "."); 2501 2522 2502 2523 // then check direction to boundary 2503 2524 if (DistanceToCenter.ScalarProduct(triangle->NormalVector) > MYEPSILON) { 2504 DoLog(1) && (Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl);2525 LOG(1, Point << " is an inner point, " << distance << " below surface."); 2505 2526 return -distance; 2506 2527 } else { 2507 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl);2528 LOG(1, Point << " is NOT an inner point, " << distance << " above surface."); 2508 2529 return +distance; 2509 2530 } … … 2560 2581 ReferencePoint = PointRunner->second; 2561 2582 } else { 2562 DoeLog(2) && (eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);2583 ELOG(2, "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "."); 2563 2584 ReferencePoint = NULL; 2564 2585 } … … 2585 2606 2586 2607 if (takePoint) { 2587 DoLog(1) && (Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl);2608 LOG(1, "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted."); 2588 2609 connectedPoints->insert(current); 2589 2610 } … … 2593 2614 2594 2615 if (connectedPoints->empty()) { // if have not found any points 2595 DoeLog(1) && (eLog() << Verbose(1) << "We have not found any connected points to " << *Point << "." << endl);2616 ELOG(1, "We have not found any connected points to " << *Point << "."); 2596 2617 return NULL; 2597 2618 } … … 2626 2647 2627 2648 if (SetOfNeighbours == NULL) { 2628 DoeLog(2) && (eLog() << Verbose(2) << "Could not find any connected points!" << endl);2649 ELOG(2, "Could not find any connected points!"); 2629 2650 delete (connectedCircle); 2630 2651 return NULL; … … 2637 2658 PlaneNormal += (*Runner)->NormalVector; 2638 2659 } else { 2639 DoeLog(0) && (eLog() << Verbose(0) << "Could not find any triangles for point " << *Point << "." << endl);2660 ELOG(0, "Could not find any triangles for point " << *Point << "."); 2640 2661 performCriticalExit(); 2641 2662 } 2642 2663 PlaneNormal.Scale(1.0 / triangles->size()); 2643 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl);2664 LOG(1, "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "."); 2644 2665 PlaneNormal.Normalize(); 2645 2666 … … 2648 2669 AngleZero.ProjectOntoPlane(PlaneNormal); 2649 2670 if ((AngleZero.NormSquared() < MYEPSILON)) { 2650 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);2671 LOG(1, "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer."); 2651 2672 AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition()); 2652 2673 AngleZero.ProjectOntoPlane(PlaneNormal); 2653 2674 if (AngleZero.NormSquared() < MYEPSILON) { 2654 DoeLog(0) && (eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);2675 ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!"); 2655 2676 performCriticalExit(); 2656 2677 } 2657 2678 } 2658 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);2679 LOG(1, "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "."); 2659 2680 if (AngleZero.NormSquared() > MYEPSILON) 2660 2681 OrthogonalVector = Plane(PlaneNormal, AngleZero,0).getNormal(); 2661 2682 else 2662 2683 OrthogonalVector.MakeNormalTo(PlaneNormal); 2663 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);2684 LOG(1, "INFO: OrthogonalVector on plane is " << OrthogonalVector << "."); 2664 2685 2665 2686 // go through all connected points and calculate angle … … 2668 2689 helper.ProjectOntoPlane(PlaneNormal); 2669 2690 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 2670 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl);2691 LOG(0, "INFO: Calculated angle is " << angle << " for point " << **listRunner << "."); 2671 2692 anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 2672 2693 } … … 2702 2723 2703 2724 if (SetOfNeighbours == NULL) { 2704 DoeLog(2) && (eLog() << Verbose(2) << "Could not find any connected points!" << endl);2725 ELOG(2, "Could not find any connected points!"); 2705 2726 delete (connectedCircle); 2706 2727 return NULL; … … 2714 2735 } 2715 2736 2716 DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << Reference << "." << endl);2737 LOG(1, "INFO: Point is " << *Point << " and Reference is " << Reference << "."); 2717 2738 // calculate central point 2718 2739 TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin(); … … 2727 2748 ((*TesselB)->getPosition()), 2728 2749 ((*TesselC)->getPosition())).getNormal(); 2729 DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);2750 LOG(0, "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper); 2730 2751 counter++; 2731 2752 TesselA++; … … 2734 2755 PlaneNormal += helper; 2735 2756 } 2736 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2737 // << "; scale factor " << counter; 2757 //LOG(0, "Summed vectors " << center << "; number of points " << connectedPoints.size() << "; scale factor " << counter); 2738 2758 PlaneNormal.Scale(1.0 / (double) counter); 2739 // L og() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;2759 // LOG(1, "INFO: Calculated center of all circle points is " << center << "."); 2740 2760 // 2741 2761 // // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 2743 2763 // PlaneNormal.SubtractVector(¢er); 2744 2764 // PlaneNormal.Normalize(); 2745 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl);2765 LOG(1, "INFO: Calculated plane normal of circle is " << PlaneNormal << "."); 2746 2766 2747 2767 // construct one orthogonal vector … … 2751 2771 } 2752 2772 if ((Reference.IsZero()) || (AngleZero.NormSquared() < MYEPSILON )) { 2753 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);2773 LOG(1, "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer."); 2754 2774 AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition()); 2755 2775 AngleZero.ProjectOntoPlane(PlaneNormal); 2756 2776 if (AngleZero.NormSquared() < MYEPSILON) { 2757 DoeLog(0) && (eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);2777 ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!"); 2758 2778 performCriticalExit(); 2759 2779 } 2760 2780 } 2761 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);2781 LOG(1, "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "."); 2762 2782 if (AngleZero.NormSquared() > MYEPSILON) 2763 2783 OrthogonalVector = Plane(PlaneNormal, AngleZero,0).getNormal(); 2764 2784 else 2765 2785 OrthogonalVector.MakeNormalTo(PlaneNormal); 2766 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);2786 LOG(1, "INFO: OrthogonalVector on plane is " << OrthogonalVector << "."); 2767 2787 2768 2788 // go through all connected points and calculate angle … … 2774 2794 if (angle > M_PI) // the correction is of no use here (and not desired) 2775 2795 angle = 2. * M_PI - angle; 2776 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl);2796 LOG(0, "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "."); 2777 2797 InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 2778 2798 if (!InserterTest.second) { 2779 DoeLog(0) && (eLog() << Verbose(0) << "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner) << endl);2799 ELOG(0, "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner)); 2780 2800 performCriticalExit(); 2781 2801 } … … 2816 2836 ReferencePoint = PointRunner->second; 2817 2837 } else { 2818 DoeLog(1) && (eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);2838 ELOG(1, "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "."); 2819 2839 return NULL; 2820 2840 } … … 2833 2853 LineRunner = TouchedLine.find(runner->second); 2834 2854 if (LineRunner == TouchedLine.end()) { 2835 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl);2855 ELOG(1, "I could not find " << *runner->second << " in the touched list."); 2836 2856 } else if (!LineRunner->second) { 2837 2857 LineRunner->second = true; … … 2841 2861 StartLine = CurrentLine; 2842 2862 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 2843 DoLog(1) && (Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl);2863 LOG(1, "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "."); 2844 2864 do { 2845 2865 // push current one 2846 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);2866 LOG(1, "INFO: Putting " << *CurrentPoint << " at end of path."); 2847 2867 connectedPath->push_back(CurrentPoint->node); 2848 2868 2849 2869 // find next triangle 2850 2870 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 2851 DoLog(1) && (Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl);2871 LOG(1, "INFO: Inspecting triangle " << *Runner->second << "."); 2852 2872 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 2853 2873 triangle = Runner->second; … … 2856 2876 if (!TriangleRunner->second) { 2857 2877 TriangleRunner->second = true; 2858 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl);2878 LOG(1, "INFO: Connecting triangle is " << *triangle << "."); 2859 2879 break; 2860 2880 } else { 2861 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl);2881 LOG(1, "INFO: Skipping " << *triangle << ", as we have already visited it."); 2862 2882 triangle = NULL; 2863 2883 } 2864 2884 } else { 2865 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl);2885 ELOG(1, "I could not find " << *triangle << " in the touched list."); 2866 2886 triangle = NULL; 2867 2887 } … … 2874 2894 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 2875 2895 CurrentLine = triangle->lines[i]; 2876 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl);2896 LOG(1, "INFO: Connecting line is " << *CurrentLine << "."); 2877 2897 break; 2878 2898 } … … 2880 2900 LineRunner = TouchedLine.find(CurrentLine); 2881 2901 if (LineRunner == TouchedLine.end()) 2882 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl);2902 ELOG(1, "I could not find " << *CurrentLine << " in the touched list."); 2883 2903 else 2884 2904 LineRunner->second = true; … … 2888 2908 } while (CurrentLine != StartLine); 2889 2909 // last point is missing, as it's on start line 2890 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);2910 LOG(1, "INFO: Putting " << *CurrentPoint << " at end of path."); 2891 2911 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 2892 2912 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 2894 2914 ListOfPaths->push_back(connectedPath); 2895 2915 } else { 2896 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl);2916 LOG(1, "INFO: Skipping " << *runner->second << ", as we have already visited it."); 2897 2917 } 2898 2918 } 2899 2919 } else { 2900 DoeLog(1) && (eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl);2920 ELOG(1, "There are no lines attached to " << *ReferencePoint << "."); 2901 2921 } 2902 2922 … … 2924 2944 connectedPath = *ListRunner; 2925 2945 2926 DoLog(1) && (Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl);2946 LOG(1, "INFO: Current path is " << connectedPath << "."); 2927 2947 2928 2948 // go through list, look for reappearance of starting Point and count … … 2933 2953 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 2934 2954 // we have a closed circle from Marker to new Marker 2935 DoLog(1) && (Log() << Verbose(1) << count + 1 << ". closed path consists of: "); 2955 if (DoLog(1)) { 2956 std::stringstream output; 2957 output << count + 1 << ". closed path consists of: "; 2958 for (TesselPointList::iterator CircleSprinter = Marker; 2959 CircleSprinter != CircleRunner; 2960 CircleSprinter++) 2961 output << (**CircleSprinter) << " <-> "; 2962 LOG(1, output.str()); 2963 } 2936 2964 newPath = new TesselPointList; 2937 2965 TesselPointList::iterator CircleSprinter = Marker; 2938 for (; CircleSprinter != CircleRunner; CircleSprinter++) {2966 for (; CircleSprinter != CircleRunner; CircleSprinter++) 2939 2967 newPath->push_back(*CircleSprinter); 2940 DoLog(0) && (Log() << Verbose(0) << (**CircleSprinter) << " <-> ");2941 }2942 DoLog(0) && (Log() << Verbose(0) << ".." << endl);2943 2968 count++; 2944 2969 Marker = CircleRunner; … … 2949 2974 } 2950 2975 } 2951 DoLog(1) && (Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl);2976 LOG(1, "INFO: " << count << " closed additional path(s) have been created."); 2952 2977 2953 2978 // delete list of paths … … 2975 3000 2976 3001 if (Point == NULL) { 2977 DoeLog(1) && (eLog() << Verbose(1) << "Point given is NULL." << endl);3002 ELOG(1, "Point given is NULL."); 2978 3003 } else { 2979 3004 // go through its lines and insert all triangles … … 3008 3033 3009 3034 if (point == NULL) { 3010 DoeLog(1) && (eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl);3035 ELOG(1, "Cannot remove the point " << point << ", it's NULL!"); 3011 3036 return 0.; 3012 3037 } else 3013 DoLog(0) && (Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl);3038 LOG(0, "Removing point " << *point << " from tesselated boundary ..."); 3014 3039 3015 3040 // copy old location for the volume … … 3018 3043 // get list of connected points 3019 3044 if (point->lines.empty()) { 3020 DoeLog(1) && (eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl);3045 ELOG(1, "Cannot remove the point " << *point << ", it's connected to no lines!"); 3021 3046 return 0.; 3022 3047 } … … 3041 3066 NormalVector.Zero(); 3042 3067 for (TriangleMap::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3043 DoLog(1) && (Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl);3068 LOG(1, "INFO: Removing triangle " << *(Runner->second) << "."); 3044 3069 NormalVector -= Runner->second->NormalVector; // has to point inward 3045 3070 RemoveTesselationTriangle(Runner->second); 3046 3071 count++; 3047 3072 } 3048 DoLog(1) && (Log() << Verbose(1) << count << " triangles were removed." << endl);3073 LOG(1, count << " triangles were removed."); 3049 3074 3050 3075 list<TesselPointList *>::iterator ListAdvance = ListOfClosedPaths->begin(); … … 3070 3095 smallestangle = 0.; 3071 3096 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3072 DoLog(1) && (Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);3097 LOG(1, "INFO: MiddleNode is " << **MiddleNode << "."); 3073 3098 // construct vectors to next and previous neighbour 3074 3099 StartNode = MiddleNode; … … 3076 3101 StartNode = connectedPath->end(); 3077 3102 StartNode--; 3078 //L og() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;3103 //LOG(3, "INFO: StartNode is " << **StartNode << "."); 3079 3104 Point = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition()); 3080 3105 StartNode = MiddleNode; … … 3082 3107 if (StartNode == connectedPath->end()) 3083 3108 StartNode = connectedPath->begin(); 3084 //L og() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;3109 //LOG(3, "INFO: EndNode is " << **StartNode << "."); 3085 3110 Reference = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition()); 3086 3111 OrthogonalVector = ((*MiddleNode)->getPosition()) - OldPoint; … … 3095 3120 MiddleNode = EndNode; 3096 3121 if (MiddleNode == connectedPath->end()) { 3097 DoeLog(0) && (eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl);3122 ELOG(0, "CRITICAL: Could not find a smallest angle!"); 3098 3123 performCriticalExit(); 3099 3124 } … … 3105 3130 if (EndNode == connectedPath->end()) 3106 3131 EndNode = connectedPath->begin(); 3107 DoLog(2) && (Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl);3108 DoLog(2) && (Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);3109 DoLog(2) && (Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl);3110 DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->getName() << ", " << (*MiddleNode)->getName() << " and " << (*EndNode)->getName() << "." << endl);3132 LOG(2, "INFO: StartNode is " << **StartNode << "."); 3133 LOG(2, "INFO: MiddleNode is " << **MiddleNode << "."); 3134 LOG(2, "INFO: EndNode is " << **EndNode << "."); 3135 LOG(1, "INFO: Attempting to create triangle " << (*StartNode)->getName() << ", " << (*MiddleNode)->getName() << " and " << (*EndNode)->getName() << "."); 3111 3136 TriangleCandidates[0] = *StartNode; 3112 3137 TriangleCandidates[1] = *MiddleNode; … … 3114 3139 triangle = GetPresentTriangle(TriangleCandidates); 3115 3140 if (triangle != NULL) { 3116 DoeLog(0) && (eLog() << Verbose(0) << "New triangle already present, skipping!" << endl);3141 ELOG(0, "New triangle already present, skipping!"); 3117 3142 StartNode++; 3118 3143 MiddleNode++; … … 3126 3151 continue; 3127 3152 } 3128 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle points." << endl);3153 LOG(3, "Adding new triangle points."); 3129 3154 AddTesselationPoint(*StartNode, 0); 3130 3155 AddTesselationPoint(*MiddleNode, 1); 3131 3156 AddTesselationPoint(*EndNode, 2); 3132 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle lines." << endl);3157 LOG(3, "Adding new triangle lines."); 3133 3158 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3134 3159 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3145 3170 // prepare nodes for next triangle 3146 3171 StartNode = EndNode; 3147 DoLog(2) && (Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl);3172 LOG(2, "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "."); 3148 3173 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3149 3174 if (connectedPath->size() == 2) { // we are done … … 3152 3177 break; 3153 3178 } else if (connectedPath->size() < 2) { // something's gone wrong! 3154 DoeLog(0) && (eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl);3179 ELOG(0, "CRITICAL: There are only two endpoints left!"); 3155 3180 performCriticalExit(); 3156 3181 } else { … … 3181 3206 if (maxgain != 0) { 3182 3207 volume += maxgain; 3183 DoLog(1) && (Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl);3208 LOG(1, "Flipping baseline with highest volume" << **Candidate << "."); 3184 3209 OtherBase = FlipBaseline(*Candidate); 3185 3210 NewLines.erase(Candidate); … … 3192 3217 delete (connectedPath); 3193 3218 } 3194 DoLog(0) && (Log() << Verbose(0) << count << " triangles were created." << endl);3219 LOG(0, count << " triangles were created."); 3195 3220 } else { 3196 3221 while (!ListOfClosedPaths->empty()) { … … 3200 3225 delete (connectedPath); 3201 3226 } 3202 DoLog(0) && (Log() << Verbose(0) << "No need to create any triangles." << endl);3227 LOG(0, "No need to create any triangles."); 3203 3228 } 3204 3229 delete (ListOfClosedPaths); 3205 3230 3206 DoLog(0) && (Log() << Verbose(0) << "Removed volume is " << volume << "." << endl);3231 LOG(0, "Removed volume is " << volume << "."); 3207 3232 3208 3233 return volume; … … 3298 3323 } 3299 3324 default: 3300 DoeLog(0) && (eLog() << Verbose(0) << "Number of wildcards is greater than 3, cannot happen!" << endl);3325 ELOG(0, "Number of wildcards is greater than 3, cannot happen!"); 3301 3326 performCriticalExit(); 3302 3327 break; … … 3354 3379 // sanity check 3355 3380 if (LinesOnBoundary.empty()) { 3356 DoeLog(2) && (eLog() << Verbose(2) <<"FindAllDegeneratedTriangles() was called without any tesselation structure.");3381 ELOG(2, "FindAllDegeneratedTriangles() was called without any tesselation structure."); 3357 3382 return DegeneratedLines; 3358 3383 } … … 3369 3394 AllLines.clear(); 3370 3395 3371 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl);3396 LOG(0, "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines."); 3372 3397 IndexToIndex::iterator it; 3373 3398 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) { … … 3375 3400 const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second); 3376 3401 if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end()) 3377 DoLog(0) && (Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl);3402 LOG(0, *Line1->second << " => " << *Line2->second); 3378 3403 else 3379 DoeLog(1) && (eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl);3404 ELOG(1, "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!"); 3380 3405 } 3381 3406 … … 3417 3442 delete (DegeneratedLines); 3418 3443 3419 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl);3444 LOG(0, "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:"); 3420 3445 for (IndexToIndex::iterator it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3421 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);3446 LOG(0, (*it).first << " => " << (*it).second); 3422 3447 3423 3448 return DegeneratedTriangles; … … 3438 3463 // iterate over all degenerated triangles 3439 3464 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); !DegeneratedTriangles->empty(); TriangleKeyRunner = DegeneratedTriangles->begin()) { 3440 DoLog(0) && (Log() << Verbose(0) << "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "." << endl);3465 LOG(0, "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "."); 3441 3466 // both ways are stored in the map, only use one 3442 3467 if (TriangleKeyRunner->first > TriangleKeyRunner->second) … … 3495 3520 // erase the pair 3496 3521 count += (int) DegeneratedTriangles->erase(triangle->Nr); 3497 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl);3522 LOG(0, "RemoveDegeneratedTriangles() removes triangle " << *triangle << "."); 3498 3523 RemoveTesselationTriangle(triangle); 3499 3524 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 3500 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl);3525 LOG(0, "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "."); 3501 3526 RemoveTesselationTriangle(partnerTriangle); 3502 3527 } else { 3503 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure." << endl);3528 LOG(0, "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure."); 3504 3529 } 3505 3530 } … … 3508 3533 LastTriangle = NULL; 3509 3534 3510 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl);3535 LOG(0, "RemoveDegeneratedTriangles() removed " << count << " triangles:"); 3511 3536 } 3512 3537 … … 3534 3559 NearestBoundaryPoint = PointRunner->second; 3535 3560 } else { 3536 DoeLog(1) && (eLog() << Verbose(1) << "I cannot find the boundary point." << endl);3561 ELOG(1, "I cannot find the boundary point."); 3537 3562 return; 3538 3563 } 3539 DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->getName() << "." << endl);3564 LOG(0, "Nearest point on boundary is " << NearestPoint->getName() << "."); 3540 3565 3541 3566 // go through its lines and find the best one to split … … 3569 3594 3570 3595 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 3571 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);3596 LOG(2, "Adding new triangle points."); 3572 3597 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3573 3598 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3574 3599 AddTesselationPoint(point, 2); 3575 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);3600 LOG(2, "Adding new triangle lines."); 3576 3601 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3577 3602 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3580 3605 BTS->GetNormalVector(TempTriangle->NormalVector); 3581 3606 BTS->NormalVector.Scale(-1.); 3582 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl);3607 LOG(1, "INFO: NormalVector of new triangle is " << BTS->NormalVector << "."); 3583 3608 AddTesselationTriangle(); 3584 3609 3585 3610 // create other side of this triangle and close both new sides of the first created triangle 3586 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);3611 LOG(2, "Adding new triangle points."); 3587 3612 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3588 3613 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3589 3614 AddTesselationPoint(point, 2); 3590 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);3615 LOG(2, "Adding new triangle lines."); 3591 3616 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3592 3617 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3594 3619 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 3595 3620 BTS->GetNormalVector(TempTriangle->NormalVector); 3596 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl);3621 LOG(1, "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "."); 3597 3622 AddTesselationTriangle(); 3598 3623 … … 3601 3626 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 3602 3627 if (BestLine == BTS->lines[i]) { 3603 DoeLog(0) && (eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl);3628 ELOG(0, "BestLine is same as found line, something's wrong here!"); 3604 3629 performCriticalExit(); 3605 3630 } … … 3634 3659 NameofTempFile.erase(npos, 1); 3635 3660 NameofTempFile.append(TecplotSuffix); 3636 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");3661 LOG(1, "INFO: Writing temporary non convex hull to file " << NameofTempFile << "."); 3637 3662 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3638 3663 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 3648 3673 NameofTempFile.erase(npos, 1); 3649 3674 NameofTempFile.append(Raster3DSuffix); 3650 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");3675 LOG(1, "INFO: Writing temporary non convex hull to file " << NameofTempFile << "."); 3651 3676 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3652 3677 WriteRaster3dFile(tempstream, this, cloud); … … 3700 3725 pair<map<int, Vector *>::iterator, bool> TriangleInsertionTester; 3701 3726 for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) { 3702 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl);3727 LOG(0, "Current point is " << *Runner->second << "."); 3703 3728 map<int, Vector *> TriangleVectors; 3704 3729 // gather all NormalVectors 3705 DoLog(1) && (Log() << Verbose(1) << "Gathering triangles ..." << endl);3730 LOG(1, "Gathering triangles ..."); 3706 3731 for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++) 3707 3732 for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) { … … 3709 3734 TriangleInsertionTester = TriangleVectors.insert(pair<int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector))); 3710 3735 if (TriangleInsertionTester.second) 3711 DoLog(1) && (Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl);3736 LOG(1, " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list."); 3712 3737 } else { 3713 DoLog(1) && (Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl);3738 LOG(1, " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one."); 3714 3739 } 3715 3740 } 3716 3741 // check whether there are two that are parallel 3717 DoLog(1) && (Log() << Verbose(1) << "Finding two parallel triangles ..." << endl);3742 LOG(1, "Finding two parallel triangles ..."); 3718 3743 for (map<int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++) 3719 3744 for (map<int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++) 3720 3745 if (VectorWalker != VectorRunner) { // skip equals 3721 3746 const double SCP = VectorWalker->second->ScalarProduct(*VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles 3722 DoLog(1) && (Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl);3747 LOG(1, "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP); 3723 3748 if (fabs(SCP + 1.) < ParallelEpsilon) { 3724 3749 InsertionTester = EndpointCandidateList.insert((Runner->second)); 3725 3750 if (InsertionTester.second) 3726 DoLog(0) && (Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl);3751 LOG(0, " Adding " << *Runner->second << " to endpoint candidate list."); 3727 3752 // and break out of both loops 3728 3753 VectorWalker = TriangleVectors.end(); … … 3743 3768 Walker = *(EndpointCandidateList.begin()); 3744 3769 if (Current == NULL) { // create a new polygon with current candidate 3745 DoLog(0) && (Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl);3770 LOG(0, "Starting new polygon set at point " << *Walker); 3746 3771 Current = new BoundaryPolygonSet; 3747 3772 Current->endpoints.insert(Walker); … … 3756 3781 for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) { 3757 3782 OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker); 3758 DoLog(1) && (Log() << Verbose(1) << "Checking " << *OtherWalker << endl);3783 LOG(1, "Checking " << *OtherWalker); 3759 3784 set<BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker); 3760 3785 if (Finder != EndpointCandidateList.end()) { // found a connected partner 3761 DoLog(1) && (Log() << Verbose(1) << " Adding to polygon." << endl);3786 LOG(1, " Adding to polygon."); 3762 3787 Current->endpoints.insert(OtherWalker); 3763 3788 EndpointCandidateList.erase(Finder); // remove from candidates 3764 3789 ToCheckConnecteds.push(OtherWalker); // but check its partners too 3765 3790 } else { 3766 DoLog(1) && (Log() << Verbose(1) << " is not connected to " << *Walker << endl);3791 LOG(1, " is not connected to " << *Walker); 3767 3792 } 3768 3793 } 3769 3794 } 3770 3795 3771 DoLog(0) && (Log() << Verbose(0) << "Final polygon is " << *Current << endl);3796 LOG(0, "Final polygon is " << *Current); 3772 3797 ListofDegeneratedPolygons.insert(Current); 3773 3798 Current = NULL; … … 3776 3801 const int counter = ListofDegeneratedPolygons.size(); 3777 3802 3778 DoLog(0) && (Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl); 3779 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 3780 DoLog(0) && (Log() << Verbose(0) << " " << **PolygonRunner << endl); 3803 if (DoLog(0)) { 3804 std::stringstream output; 3805 output << "The following " << counter << " degenerated polygons have been found: "; 3806 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 3807 output << " " << **PolygonRunner; 3808 LOG(0, output.str()); 3809 } 3781 3810 3782 3811 /// 4. Go through all these degenerated polygons … … 3789 3818 // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do. 3790 3819 if (T->size() == 2) { 3791 DoLog(1) && (Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl);3820 LOG(1, " Skipping degenerated polygon, is just a (already simply degenerated) triangle."); 3792 3821 delete (T); 3793 3822 continue; … … 3799 3828 // connections to either polygon ... 3800 3829 if (T->size() % 2 != 0) { 3801 DoeLog(0) && (eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl);3830 ELOG(0, " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!"); 3802 3831 performCriticalExit(); 3803 3832 } … … 3805 3834 /// 4a. Get NormalVector for one side (this is "front") 3806 3835 NormalVector = (*TriangleWalker)->NormalVector; 3807 DoLog(1) && (Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl);3836 LOG(1, "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector); 3808 3837 TriangleWalker++; 3809 3838 TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator … … 3814 3843 triangle = *TriangleWalker; 3815 3844 TriangleSprinter++; 3816 DoLog(1) && (Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl);3845 LOG(1, "Current triangle to test for removal: " << *triangle); 3817 3846 if (triangle->NormalVector.ScalarProduct(NormalVector) < 0) { // if from other side, then delete and remove from list 3818 DoLog(1) && (Log() << Verbose(1) << " Removing ... " << endl);3847 LOG(1, " Removing ... "); 3819 3848 TriangleNrs.push(triangle->Nr); 3820 3849 T->erase(TriangleWalker); 3821 3850 RemoveTesselationTriangle(triangle); 3822 3851 } else 3823 DoLog(1) && (Log() << Verbose(1) << " Keeping ... " << endl);3852 LOG(1, " Keeping ... "); 3824 3853 } 3825 3854 /// 4c. Copy all "front" triangles but with inverse NormalVector 3826 3855 TriangleWalker = T->begin(); 3827 3856 while (TriangleWalker != T->end()) { // go through all front triangles 3828 DoLog(1) && (Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl);3857 LOG(1, " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector); 3829 3858 for (int i = 0; i < 3; i++) 3830 3859 AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i); … … 3833 3862 AddTesselationLine(NULL, NULL, TPS[1], TPS[2], 2); 3834 3863 if (TriangleNrs.empty()) 3835 DoeLog(0) && (eLog() << Verbose(0) << "No more free triangle numbers!" << endl);3864 ELOG(0, "No more free triangle numbers!"); 3836 3865 BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ... 3837 3866 AddTesselationTriangle(); // ... and add … … 3841 3870 } 3842 3871 if (!TriangleNrs.empty()) { 3843 DoeLog(0) && (eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl);3872 ELOG(0, "There have been less triangles created than removed!"); 3844 3873 } 3845 3874 delete (T); // remove the triangleset 3846 3875 } 3847 3876 IndexToIndex * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles(); 3848 DoLog(0) && (Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl);3877 LOG(0, "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:"); 3849 3878 IndexToIndex::iterator it; 3850 3879 for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++) 3851 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);3880 LOG(0, (*it).first << " => " << (*it).second); 3852 3881 delete (SimplyDegeneratedTriangles); 3853 3882 /// 5. exit
Note:
See TracChangeset
for help on using the changeset viewer.