Changeset a67d19 for src/tesselation.cpp
- Timestamp:
- Apr 22, 2010, 2:00:03 PM (15 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:
- 299554
- Parents:
- 6613ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
r6613ec ra67d19 28 28 { 29 29 Info FunctionInfo(__func__); 30 Log() << Verbose(1) << "Adding noname." << endl;30 DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl); 31 31 } 32 32 ; … … 39 39 { 40 40 Info FunctionInfo(__func__); 41 Log() << Verbose(1) << "Adding Node " << *Walker << endl;41 DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl); 42 42 } 43 43 ; … … 63 63 { 64 64 Info FunctionInfo(__func__); 65 Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl;65 DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl); 66 66 if (line->endpoints[0] == this) { 67 67 lines.insert(LinePair(line->endpoints[1]->Nr, line)); … … 115 115 skipped = false; 116 116 // clear triangles list 117 Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;117 DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl); 118 118 } 119 119 ; … … 138 138 skipped = false; 139 139 // clear triangles list 140 Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;140 DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl); 141 141 } 142 142 ; … … 196 196 { 197 197 Info FunctionInfo(__func__); 198 Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl;198 DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl); 199 199 triangles.insert(TrianglePair(triangle->Nr, triangle)); 200 200 } … … 270 270 //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl; 271 271 if (NormalCheck.NormSquared() < MYEPSILON) { 272 Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;272 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl); 273 273 return true; 274 274 } … … 276 276 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 277 277 if ((angle - M_PI) > -MYEPSILON) { 278 Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl;278 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl); 279 279 return true; 280 280 } else { 281 Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl;281 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl); 282 282 return false; 283 283 } … … 364 364 // set endpoints 365 365 int Counter = 0; 366 Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl;366 DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl); 367 367 for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) { 368 368 endpoints[Counter] = runner->second; 369 Log() << Verbose(0) << " " << *endpoints[Counter] << endl;369 DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl); 370 370 Counter++; 371 371 } … … 413 413 if (NormalVector.ScalarProduct(&OtherVector) > 0.) 414 414 NormalVector.Scale(-1.); 415 Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;415 DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl); 416 416 } 417 417 ; … … 440 440 } 441 441 442 Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl;443 Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl;444 Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl;442 DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl); 443 DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl); 444 DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl); 445 445 446 446 if (Intersection->DistanceSquared(endpoints[0]->node->node) < MYEPSILON) { 447 Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl;447 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl); 448 448 return true; 449 449 } else if (Intersection->DistanceSquared(endpoints[1]->node->node) < MYEPSILON) { 450 Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl;450 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl); 451 451 return true; 452 452 } else if (Intersection->DistanceSquared(endpoints[2]->node->node) < MYEPSILON) { 453 Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl;453 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl); 454 454 return true; 455 455 } … … 462 462 CrossPoint.SubtractVector(endpoints[i % 3]->node->node); // cross point was returned as absolute vector 463 463 const double s = CrossPoint.ScalarProduct(&helper) / helper.NormSquared(); 464 Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl;464 DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl); 465 465 if ((s < -MYEPSILON) || ((s - 1.) > MYEPSILON)) { 466 Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl;466 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl); 467 467 i = 4; 468 468 break; … … 473 473 } while (i < 3); 474 474 if (i == 3) { 475 Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl;475 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl); 476 476 return true; 477 477 } else { 478 Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl;478 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl); 479 479 return false; 480 480 } … … 500 500 501 501 // 1. get intersection with plane 502 Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl;502 DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl); 503 503 GetCenter(&Direction); 504 504 if (!ClosestPoint->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, x, &Direction)) { … … 513 513 InPlane.AddVector(ClosestPoint); 514 514 515 Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl;516 Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl;517 Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl;515 DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl); 516 DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl); 517 DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl); 518 518 519 519 // Calculate cross point between one baseline and the desired point such that distance is shortest … … 533 533 CrossPoint[i].SubtractVector(endpoints[i % 3]->node->node); // cross point was returned as absolute vector 534 534 const double s = CrossPoint[i].ScalarProduct(&Direction) / Direction.NormSquared(); 535 Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl;535 DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl); 536 536 if ((s >= -MYEPSILON) && ((s - 1.) <= MYEPSILON)) { 537 537 CrossPoint[i].AddVector(endpoints[i % 3]->node->node); // make cross point absolute again 538 Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl;538 DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl); 539 539 const double distance = CrossPoint[i].DistanceSquared(x); 540 540 if ((ShortestDistance < 0.) || (ShortestDistance > distance)) { … … 565 565 } 566 566 } 567 Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl;567 DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl); 568 568 return ShortestDistance; 569 569 } … … 619 619 { 620 620 Info FunctionInfo(__func__); 621 Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl;621 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl); 622 622 return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2]) 623 623 … … 668 668 center->AddVector(endpoints[i]->node->node); 669 669 center->Scale(1. / 3.); 670 Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl;670 DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl); 671 671 } 672 672 … … 703 703 Info FunctionInfo(__func__); 704 704 endpoints.clear(); 705 Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl;705 DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl); 706 706 } 707 707 ; … … 742 742 if (TotalNormal->ScalarProduct(&OtherVector) > 0.) 743 743 TotalNormal->Scale(-1.); 744 Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl;744 DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl); 745 745 746 746 return TotalNormal; … … 762 762 } 763 763 center->Scale(1. / (double) counter); 764 Log() << Verbose(1) << "Center is at " << *center << "." << endl;764 DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl); 765 765 } 766 766 … … 795 795 Info FunctionInfo(__func__); 796 796 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 797 Log() << Verbose(0) << "Checking against " << **Runner << endl;797 DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl); 798 798 if (point == (*Runner)) { 799 Log() << Verbose(0) << " Contained." << endl;799 DoLog(0) && (Log() << Verbose(0) << " Contained." << endl); 800 800 return true; 801 801 } 802 802 } 803 Log() << Verbose(0) << " Not contained." << endl;803 DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl); 804 804 return false; 805 805 } … … 815 815 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) 816 816 if (point == (*Runner)->node) { 817 Log() << Verbose(0) << " Contained." << endl;817 DoLog(0) && (Log() << Verbose(0) << " Contained." << endl); 818 818 return true; 819 819 } 820 Log() << Verbose(0) << " Not contained." << endl;820 DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl); 821 821 return false; 822 822 } … … 832 832 Info FunctionInfo(__func__); 833 833 int counter = 0; 834 Log() << Verbose(1) << "Polygon is " << *this << endl;834 DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl); 835 835 for (int i = 0; i < dim; i++) { 836 Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl;836 DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl); 837 837 if (ContainsBoundaryPoint(Points[i])) { 838 838 counter++; … … 855 855 Info FunctionInfo(__func__); 856 856 size_t counter = 0; 857 Log() << Verbose(1) << "Polygon is " << *this << endl;857 DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl); 858 858 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 859 Log() << Verbose(1) << " Testing endpoint " << **Runner << endl;859 DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl); 860 860 if (ContainsBoundaryPoint(*Runner)) 861 861 counter++; … … 895 895 Tester = triangles->insert(Sprinter->second); 896 896 if (Tester.second) 897 Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl;897 DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl); 898 898 } 899 899 } 900 900 901 Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl;901 DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl); 902 902 return triangles; 903 903 } … … 914 914 if (line == NULL) 915 915 return false; 916 Log() << Verbose(1) << "Filling polygon from line " << *line << endl;916 DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl); 917 917 for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) { 918 918 for (int i = 0; i < 3; i++) { 919 919 Tester = endpoints.insert((Runner->second)->endpoints[i]); 920 920 if (Tester.second) 921 Log() << Verbose(1) << " Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl;921 DoLog(1) && (Log() << Verbose(1) << " Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl); 922 922 } 923 923 } … … 1071 1071 return false; 1072 1072 } else { 1073 Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl;1073 DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl); 1074 1074 } 1075 1075 } … … 1082 1082 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner)); 1083 1083 1084 Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl;1084 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl); 1085 1085 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1086 Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&OtherOptCenter) << "." << endl;1086 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&OtherOptCenter) << "." << endl); 1087 1087 1088 1088 // remove baseline's endpoints and candidates 1089 1089 for (int i = 0; i < 2; i++) { 1090 Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl;1090 DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl); 1091 1091 ListofPoints->remove(BaseLine->endpoints[i]->node); 1092 1092 } 1093 1093 for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) { 1094 Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl;1094 DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl); 1095 1095 ListofPoints->remove(*Runner); 1096 1096 } … … 1106 1106 // check with animate_sphere.tcl VMD script 1107 1107 if (ThirdPoint != NULL) { 1108 Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl;1108 DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl); 1109 1109 } else { 1110 Log() << Verbose(1) << "Check by: ... missing third point ..." << endl;1111 Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl;1110 DoLog(1) && (Log() << Verbose(1) << "Check by: ... missing third point ..." << endl); 1111 DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl); 1112 1112 } 1113 1113 } … … 1157 1157 { 1158 1158 Info FunctionInfo(__func__); 1159 Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl;1159 DoLog(0) && (Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl); 1160 1160 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 1161 1161 if (runner->second != NULL) { … … 1165 1165 DoeLog(1) && (eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl); 1166 1166 } 1167 Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;1167 DoLog(0) && (Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl); 1168 1168 } 1169 1169 ; … … 1319 1319 // 3. construct plane vector 1320 1320 PlaneVector.MakeNormalVector(A->second->node->node, baseline->second.first->second->node->node, baseline->second.second->second->node->node); 1321 Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl;1321 DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl); 1322 1322 // 4. loop over all points 1323 1323 double sign = 0.; … … 1333 1333 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 1334 1334 continue; 1335 Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl;1335 DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl); 1336 1336 tmp = distance / fabs(distance); 1337 1337 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) 1338 1338 if ((sign != 0) && (tmp != sign)) { 1339 1339 // 4c. If so, break 4. loop and continue with next candidate in 1. loop 1340 Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leaves " << checker->second->node->Name << " outside the convex hull." << endl;1340 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leaves " << checker->second->node->Name << " outside the convex hull." << endl); 1341 1341 break; 1342 1342 } else { // note the sign for later 1343 Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leave " << checker->second->node->Name << " inside the convex hull." << endl;1343 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leave " << checker->second->node->Name << " inside the convex hull." << endl); 1344 1344 sign = tmp; 1345 1345 } … … 1361 1361 // 5. come this far, all on same side? Then break 1. loop and construct triangle 1362 1362 if (checker == PointsOnBoundary.end()) { 1363 Log() << Verbose(2) << "Looks like we have a candidate!" << endl;1363 DoLog(2) && (Log() << Verbose(2) << "Looks like we have a candidate!" << endl); 1364 1364 break; 1365 1365 } … … 1385 1385 } 1386 1386 1387 Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl;1387 DoLog(1) && (Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl); 1388 1388 } else { 1389 1389 DoeLog(0) && (eLog() << Verbose(0) << "No starting triangle found." << endl); … … 1426 1426 // get peak point with respect to this base line's only triangle 1427 1427 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 1428 Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl;1428 DoLog(0) && (Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl); 1429 1429 for (int i = 0; i < 3; i++) 1430 1430 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 1431 1431 peak = BTS->endpoints[i]; 1432 Log() << Verbose(1) << " and has peak " << *peak << "." << endl;1432 DoLog(1) && (Log() << Verbose(1) << " and has peak " << *peak << "." << endl); 1433 1433 1434 1434 // prepare some auxiliary vectors … … 1445 1445 CenterVector.AddVector(BTS->endpoints[i]->node->node); 1446 1446 CenterVector.Scale(1. / 3.); 1447 Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl;1447 DoLog(2) && (Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl); 1448 1448 1449 1449 // normal vector of triangle … … 1452 1452 BTS->GetNormalVector(NormalVector); 1453 1453 NormalVector.CopyVector(&BTS->NormalVector); 1454 Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl;1454 DoLog(2) && (Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl); 1455 1455 1456 1456 // vector in propagation direction (out of triangle) … … 1462 1462 if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline 1463 1463 PropagationVector.Scale(-1.); 1464 Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl;1464 DoLog(2) && (Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl); 1465 1465 winner = PointsOnBoundary.end(); 1466 1466 … … 1468 1468 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 1469 1469 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 1470 Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl;1470 DoLog(1) && (Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl); 1471 1471 1472 1472 // first check direction, so that triangles don't intersect … … 1475 1475 VirtualNormalVector.ProjectOntoPlane(&NormalVector); 1476 1476 TempAngle = VirtualNormalVector.Angle(&PropagationVector); 1477 Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;1477 DoLog(2) && (Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl); 1478 1478 if (TempAngle > (M_PI / 2.)) { // no bends bigger than Pi/2 (90 degrees) 1479 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;1479 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl); 1480 1480 continue; 1481 1481 } else 1482 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;1482 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl); 1483 1483 1484 1484 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 1486 1486 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 1487 1487 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 1488 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;1488 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); 1489 1489 continue; 1490 1490 } 1491 1491 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 1492 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;1492 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); 1493 1493 continue; 1494 1494 } … … 1496 1496 // check whether the envisaged triangle does not already exist (if both lines exist and have same endpoint) 1497 1497 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)))) { 1498 Log() << Verbose(4) << "Current target is peak!" << endl;1498 DoLog(4) && (Log() << Verbose(4) << "Current target is peak!" << endl); 1499 1499 continue; 1500 1500 } … … 1507 1507 helper.ProjectOntoPlane(&TempVector); 1508 1508 if (fabs(helper.NormSquared()) < MYEPSILON) { 1509 Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl;1509 DoLog(2) && (Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl); 1510 1510 continue; 1511 1511 } … … 1524 1524 // calculate angle 1525 1525 TempAngle = NormalVector.Angle(&VirtualNormalVector); 1526 Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;1526 DoLog(2) && (Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl); 1527 1527 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 1528 1528 SmallestAngle = TempAngle; 1529 1529 winner = target; 1530 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1530 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl); 1531 1531 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 1532 1532 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 1546 1546 SmallestAngle = TempAngle; 1547 1547 winner = target; 1548 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;1548 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl); 1549 1549 } else 1550 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;1550 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl); 1551 1551 } else 1552 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1552 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl); 1553 1553 } 1554 1554 } // end of loop over all boundary points … … 1556 1556 // 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 1557 1557 if (winner != PointsOnBoundary.end()) { 1558 Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;1558 DoLog(0) && (Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl); 1559 1559 // create the lins of not yet present 1560 1560 BLS[0] = baseline->second; … … 1591 1591 // 5d. If the set of lines is not yet empty, go to 5. and continue 1592 1592 } else 1593 Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;1593 DoLog(0) && (Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl); 1594 1594 } while (flag); 1595 1595 … … 1624 1624 } 1625 1625 Walker = cloud->GetPoint(); 1626 Log() << Verbose(0) << "Current point is " << *Walker << "." << endl;1626 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl); 1627 1627 // get the next triangle 1628 1628 triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints); 1629 1629 BTS = triangles->front(); 1630 1630 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1631 Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl;1631 DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl); 1632 1632 cloud->GoToNext(); 1633 1633 continue; 1634 1634 } else { 1635 1635 } 1636 Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl;1636 DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl); 1637 1637 // get the intersection point 1638 1638 if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) { 1639 Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl;1639 DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl); 1640 1640 // we have the intersection, check whether in- or outside of boundary 1641 1641 if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) { 1642 1642 // inside, next! 1643 Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;1643 DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl); 1644 1644 } else { 1645 1645 // outside! 1646 Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;1646 DoLog(0) && (Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl); 1647 1647 class BoundaryLineSet *OldLines[3], *NewLines[3]; 1648 1648 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 1654 1654 Normal.CopyVector(&BTS->NormalVector); 1655 1655 // add Walker to boundary points 1656 Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl;1656 DoLog(0) && (Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl); 1657 1657 AddFlag = true; 1658 1658 if (AddBoundaryPoint(Walker, 0)) … … 1661 1661 continue; 1662 1662 // remove triangle 1663 Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl;1663 DoLog(0) && (Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl); 1664 1664 TrianglesOnBoundary.erase(BTS->Nr); 1665 1665 delete (BTS); … … 1669 1669 BPS[1] = OldPoints[i]; 1670 1670 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 1671 Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl;1671 DoLog(1) && (Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl); 1672 1672 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 1673 1673 LinesOnBoundaryCount++; … … 1691 1691 BTS->GetNormalVector(Normal); 1692 1692 Normal.Scale(-1.); 1693 Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl;1693 DoLog(0) && (Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl); 1694 1694 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1695 1695 TrianglesOnBoundaryCount++; … … 1746 1746 } else { 1747 1747 delete TPS[n]; 1748 Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;1748 DoLog(0) && (Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl); 1749 1749 TPS[n] = (InsertUnique.first)->second; 1750 1750 } … … 1783 1783 BoundaryLineSet *WinningLine = NULL; 1784 1784 if (FindLine != a->lines.end()) { 1785 Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;1785 DoLog(1) && (Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl); 1786 1786 1787 1787 pair<LineMap::iterator, LineMap::iterator> FindPair; … … 1789 1789 1790 1790 for (FindLine = FindPair.first; (FindLine != FindPair.second) && (insertNewLine); FindLine++) { 1791 Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl;1791 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl); 1792 1792 // If there is a line with less than two attached triangles, we don't need a new line. 1793 1793 if (FindLine->second->triangles.size() == 1) { 1794 1794 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 1795 1795 if (!Finder->second->pointlist.empty()) 1796 Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl;1796 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl); 1797 1797 else 1798 Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl;1798 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl); 1799 1799 // get open line 1800 1800 for (TesselPointList::const_iterator CandidateChecker = Finder->second->pointlist.begin(); CandidateChecker != Finder->second->pointlist.end(); ++CandidateChecker) { … … 1828 1828 { 1829 1829 Info FunctionInfo(__func__); 1830 Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;1830 DoLog(0) && (Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl); 1831 1831 BPS[0] = a; 1832 1832 BPS[1] = b; … … 1850 1850 { 1851 1851 Info FunctionInfo(__func__); 1852 Log() << Verbose(0) << "Using existing line " << *Line << endl;1852 DoLog(0) && (Log() << Verbose(0) << "Using existing line " << *Line << endl); 1853 1853 1854 1854 // set endpoints and line … … 1859 1859 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 1860 1860 if (CandidateLine != OpenLines.end()) { 1861 Log() << Verbose(1) << " Removing line from OpenLines." << endl;1861 DoLog(1) && (Log() << Verbose(1) << " Removing line from OpenLines." << endl); 1862 1862 delete (CandidateLine->second); 1863 1863 OpenLines.erase(CandidateLine); … … 1874 1874 { 1875 1875 Info FunctionInfo(__func__); 1876 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;1876 DoLog(1) && (Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl); 1877 1877 1878 1878 // add triangle to global map … … 1894 1894 { 1895 1895 Info FunctionInfo(__func__); 1896 Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl;1896 DoLog(0) && (Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl); 1897 1897 1898 1898 // add triangle to global map … … 1918 1918 for (int i = 0; i < 3; i++) { 1919 1919 if (triangle->lines[i] != NULL) { 1920 Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;1920 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl); 1921 1921 triangle->lines[i]->triangles.erase(triangle->Nr); 1922 1922 if (triangle->lines[i]->triangles.empty()) { 1923 Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;1923 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl); 1924 1924 RemoveTesselationLine(triangle->lines[i]); 1925 1925 } else { 1926 Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ";1926 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: "); 1927 1927 OpenLines.insert(pair<BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL)); 1928 1928 for (TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 1929 Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";1930 Log() << Verbose(0) << endl;1929 DoLog(0) && (Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"); 1930 DoLog(0) && (Log() << Verbose(0) << endl); 1931 1931 // for (int j=0;j<2;j++) { 1932 1932 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; … … 1942 1942 1943 1943 if (TrianglesOnBoundary.erase(triangle->Nr)) 1944 Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;1944 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl); 1945 1945 delete (triangle); 1946 1946 } … … 1974 1974 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 1975 1975 if ((*Runner).second == line) { 1976 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1976 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl); 1977 1977 line->endpoints[i]->lines.erase(Runner); 1978 1978 break; … … 1980 1980 } else { // there's just a single line left 1981 1981 if (line->endpoints[i]->lines.erase(line->Nr)) 1982 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1982 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl); 1983 1983 } 1984 1984 if (line->endpoints[i]->lines.empty()) { 1985 Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;1985 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl); 1986 1986 RemoveTesselationPoint(line->endpoints[i]); 1987 1987 } else { 1988 Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: ";1988 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "); 1989 1989 for (LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 1990 Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";1991 Log() << Verbose(0) << endl;1990 DoLog(0) && (Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"); 1991 DoLog(0) && (Log() << Verbose(0) << endl); 1992 1992 } 1993 1993 line->endpoints[i] = NULL; // free'd or not: disconnect … … 1999 1999 2000 2000 if (LinesOnBoundary.erase(line->Nr)) 2001 Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl;2001 DoLog(0) && (Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl); 2002 2002 delete (line); 2003 2003 } … … 2015 2015 return; 2016 2016 if (PointsOnBoundary.erase(point->Nr)) 2017 Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl;2017 DoLog(0) && (Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl); 2018 2018 delete (point); 2019 2019 } … … 2035 2035 bool flag = true; 2036 2036 2037 Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter.x[0] << " " << CandidateLine.OtherOptCenter.x[1] << " " << CandidateLine.OtherOptCenter.x[2] << "} radius " << RADIUS << " resolution 30" << endl;2037 DoLog(1) && (Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter.x[0] << " " << CandidateLine.OtherOptCenter.x[1] << " " << CandidateLine.OtherOptCenter.x[2] << "} radius " << RADIUS << " resolution 30" << endl); 2038 2038 // get all points inside the sphere 2039 2039 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, &CandidateLine.OtherOptCenter); 2040 2040 2041 Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl;2041 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl); 2042 2042 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 2043 Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl;2043 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl); 2044 2044 2045 2045 // remove triangles's endpoints … … 2053 2053 // check for other points 2054 2054 if (!ListofPoints->empty()) { 2055 Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl;2055 DoLog(1) && (Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl); 2056 2056 flag = false; 2057 Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl;2057 DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl); 2058 2058 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 2059 Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl;2059 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl); 2060 2060 } 2061 2061 delete (ListofPoints); … … 2098 2098 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) { 2099 2099 TriangleMap *triangles = &FindLine->second->triangles; 2100 Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;2100 DoLog(1) && (Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl); 2101 2101 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 2102 2102 if (FindTriangle->second->IsPresentTupel(Points)) { … … 2104 2104 } 2105 2105 } 2106 Log() << Verbose(1) << "end." << endl;2106 DoLog(1) && (Log() << Verbose(1) << "end." << endl); 2107 2107 } 2108 2108 // Only one of the triangle lines must be considered for the triangle count. … … 2114 2114 } 2115 2115 2116 Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;2116 DoLog(0) && (Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl); 2117 2117 return adjacentTriangleCount; 2118 2118 } … … 2211 2211 for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 2212 2212 if ((*Runner)->node->x[i] > maxCoordinate[i]) { 2213 Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;2213 DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl); 2214 2214 maxCoordinate[i] = (*Runner)->node->x[i]; 2215 2215 MaxPoint[i] = (*Runner); … … 2222 2222 } 2223 2223 2224 Log() << Verbose(1) << "Found maximum coordinates: ";2224 DoLog(1) && (Log() << Verbose(1) << "Found maximum coordinates: "); 2225 2225 for (int i = 0; i < NDIM; i++) 2226 Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";2227 Log() << Verbose(0) << endl;2226 DoLog(0) && (Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"); 2227 DoLog(0) && (Log() << Verbose(0) << endl); 2228 2228 2229 2229 BTS = NULL; … … 2233 2233 BaseLine = new BoundaryLineSet(); 2234 2234 BaseLine->endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 2235 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl;2235 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl); 2236 2236 2237 2237 double ShortestAngle; … … 2271 2271 2272 2272 // adding point 1 and point 2 and add the line between them 2273 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl;2274 Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n";2273 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl); 2274 DoLog(0) && (Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n"); 2275 2275 2276 2276 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n"; 2277 2277 CandidateForTesselation OptCandidates(BaseLine); 2278 2278 FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC); 2279 Log() << Verbose(0) << "List of third Points is:" << endl;2279 DoLog(0) && (Log() << Verbose(0) << "List of third Points is:" << endl); 2280 2280 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 2281 Log() << Verbose(0) << " " << *(*it) << endl;2281 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl); 2282 2282 } 2283 2283 if (!OptCandidates.pointlist.empty()) { … … 2465 2465 break; 2466 2466 } 2467 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl;2467 DoLog(0) && (Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl); 2468 2468 2469 2469 CandidateLine.T = &T; … … 2487 2487 CircleRadius = RADIUS * RADIUS - radius / 4.; 2488 2488 CirclePlaneNormal.Normalize(); 2489 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;2490 2491 Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl;2489 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl); 2490 2491 DoLog(1) && (Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl); 2492 2492 2493 2493 // construct SearchDirection and an "outward pointer" … … 2497 2497 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 2498 2498 SearchDirection.Scale(-1.); 2499 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;2499 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl); 2500 2500 if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 2501 2501 // rotated the wrong way! … … 2507 2507 2508 2508 } else { 2509 Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;2509 DoLog(0) && (Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl); 2510 2510 } 2511 2511 … … 2514 2514 return false; 2515 2515 } 2516 Log() << Verbose(0) << "Third Points are: " << endl;2516 DoLog(0) && (Log() << Verbose(0) << "Third Points are: " << endl); 2517 2517 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 2518 Log() << Verbose(0) << " " << *(*it) << endl;2518 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl); 2519 2519 } 2520 2520 … … 2539 2539 if (baseline->pointlist.empty()) { 2540 2540 T = (((baseline->BaseLine->triangles.begin()))->second); 2541 Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;2541 DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl); 2542 2542 TesselationFailFlag = TesselationFailFlag && FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 2543 2543 } … … 2569 2569 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node); 2570 2570 2571 Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl;2571 DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl); 2572 2572 for (TesselPointList::iterator TesselRunner = connectedClosestPoints->begin(); TesselRunner != connectedClosestPoints->end(); ++TesselRunner) 2573 Log() << Verbose(0) << " " << **TesselRunner << endl;2573 DoLog(0) && (Log() << Verbose(0) << " " << **TesselRunner << endl); 2574 2574 2575 2575 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) … … 2578 2578 Sprinter++; 2579 2579 while (Sprinter != connectedClosestPoints->end()) { 2580 Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl;2580 DoLog(0) && (Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl); 2581 2581 2582 2582 AddTesselationPoint(TurningPoint, 0); … … 2591 2591 // fill the internal open lines with its respective candidate (otherwise lines in degenerate case are not picked) 2592 2592 FindDegeneratedCandidatesforOpenLines(*Sprinter, &CandidateLine.OptCenter); 2593 Log() << Verbose(0) << " There are still more triangles to add." << endl;2593 DoLog(0) && (Log() << Verbose(0) << " There are still more triangles to add." << endl); 2594 2594 } 2595 2595 // pick candidates for other open lines as well … … 2599 2599 if (CheckDegeneracy(CandidateLine, RADIUS, LC)) { 2600 2600 // add normal and degenerate triangles 2601 Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl;2601 DoLog(1) && (Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl); 2602 2602 AddCandidateTriangle(CandidateLine, OtherOpt); 2603 2603 … … 2623 2623 pair<LineMap::iterator, LineMap::iterator> FindPair = TPS[0]->lines.equal_range(TPS[2]->node->nr); 2624 2624 for (LineMap::const_iterator FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { 2625 Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl;2625 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl); 2626 2626 // If there is a line with less than two attached triangles, we don't need a new line. 2627 2627 if (FindLine->second->triangles.size() == 1) { 2628 2628 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 2629 2629 if (!Finder->second->pointlist.empty()) 2630 Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl;2630 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl); 2631 2631 else { 2632 Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl;2632 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl); 2633 2633 Finder->second->pointlist.push_back(Sprinter); 2634 2634 Finder->second->ShortestAngle = 0.; … … 2654 2654 2655 2655 /// 1. Create or pick the lines for the first triangle 2656 Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl;2656 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl); 2657 2657 for (int i = 0; i < 3; i++) { 2658 2658 BLS[i] = NULL; 2659 Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;2659 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl); 2660 2660 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 2661 2661 } 2662 2662 2663 2663 /// 2. create the first triangle and NormalVector and so on 2664 Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl;2664 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl); 2665 2665 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2666 2666 AddTesselationTriangle(); … … 2673 2673 // give some verbose output about the whole procedure 2674 2674 if (CandidateLine.T != NULL) 2675 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;2675 DoLog(0) && (Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl); 2676 2676 else 2677 Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;2677 DoLog(0) && (Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl); 2678 2678 triangle = BTS; 2679 2679 2680 2680 /// 3. Gather candidates for each new line 2681 Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl;2681 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl); 2682 2682 for (int i = 0; i < 3; i++) { 2683 Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;2683 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl); 2684 2684 CandidateCheck = OpenLines.find(BLS[i]); 2685 2685 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 2691 2691 2692 2692 /// 4. Create or pick the lines for the second triangle 2693 Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl;2693 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl); 2694 2694 for (int i = 0; i < 3; i++) { 2695 Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;2695 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl); 2696 2696 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 2697 2697 } 2698 2698 2699 2699 /// 5. create the second triangle and NormalVector and so on 2700 Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl;2700 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl); 2701 2701 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2702 2702 AddTesselationTriangle(); … … 2708 2708 // give some verbose output about the whole procedure 2709 2709 if (CandidateLine.T != NULL) 2710 Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;2710 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl); 2711 2711 else 2712 Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;2712 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl); 2713 2713 2714 2714 /// 6. Adding triangle to new lines 2715 Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl;2715 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl); 2716 2716 for (int i = 0; i < 3; i++) { 2717 Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;2717 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl); 2718 2718 CandidateCheck = OpenLines.find(BLS[i]); 2719 2719 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 2753 2753 // give some verbose output about the whole procedure 2754 2754 if (CandidateLine.T != NULL) 2755 Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;2755 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); 2756 2756 else 2757 Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;2757 DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl); 2758 2758 } 2759 2759 ; … … 2780 2780 OtherBase = new class BoundaryLineSet(BPS, -1); 2781 2781 2782 Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl;2783 Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl;2782 DoLog(1) && (Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl); 2783 DoLog(1) && (Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl); 2784 2784 2785 2785 // get the closest point on each line to the other line … … 2801 2801 delete (ClosestPoint); 2802 2802 if ((distance[0] * distance[1]) > 0) { // have same sign? 2803 Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;2803 DoLog(1) && (Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl); 2804 2804 if (distance[0] < distance[1]) { 2805 2805 Spot = Base->endpoints[0]; … … 2809 2809 return Spot; 2810 2810 } else { // different sign, i.e. we are in between 2811 Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;2811 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl); 2812 2812 return NULL; 2813 2813 } … … 2820 2820 Info FunctionInfo(__func__); 2821 2821 // print all lines 2822 Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl;2822 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl); 2823 2823 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin(); PointRunner != PointsOnBoundary.end(); PointRunner++) 2824 Log() << Verbose(0) << *(PointRunner->second) << endl;2824 DoLog(0) && (Log() << Verbose(0) << *(PointRunner->second) << endl); 2825 2825 } 2826 2826 ; … … 2830 2830 Info FunctionInfo(__func__); 2831 2831 // print all lines 2832 Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl;2832 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl); 2833 2833 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 2834 Log() << Verbose(0) << *(LineRunner->second) << endl;2834 DoLog(0) && (Log() << Verbose(0) << *(LineRunner->second) << endl); 2835 2835 } 2836 2836 ; … … 2840 2840 Info FunctionInfo(__func__); 2841 2841 // print all triangles 2842 Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl;2842 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl); 2843 2843 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 2844 Log() << Verbose(0) << *(TriangleRunner->second) << endl;2844 DoLog(0) && (Log() << Verbose(0) << *(TriangleRunner->second) << endl); 2845 2845 } 2846 2846 ; … … 2865 2865 OtherBase = new class BoundaryLineSet(BPS, -1); 2866 2866 2867 Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl;2868 Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl;2867 DoLog(0) && (Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl); 2868 DoLog(0) && (Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl); 2869 2869 2870 2870 // get the closest point on each line to the other line … … 2886 2886 2887 2887 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 2888 Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;2888 DoLog(0) && (Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl); 2889 2889 return false; 2890 2890 } else { // check for sign against BaseLineNormal … … 2896 2896 } 2897 2897 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2898 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2898 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl); 2899 2899 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2900 2900 } … … 2902 2902 2903 2903 if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 2904 Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;2904 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl); 2905 2905 // calculate volume summand as a general tetraeder 2906 2906 return volume; 2907 2907 } else { // Base higher than OtherBase -> do nothing 2908 Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl;2908 DoLog(0) && (Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl); 2909 2909 return 0.; 2910 2910 } … … 2936 2936 } 2937 2937 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2938 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2938 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl); 2939 2939 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2940 2940 } … … 2949 2949 i = 0; 2950 2950 m = 0; 2951 Log() << Verbose(0) << "The four old lines are: ";2951 DoLog(0) && (Log() << Verbose(0) << "The four old lines are: "); 2952 2952 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2953 2953 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 2954 2954 if (runner->second->lines[j] != Base) { // pick not the central baseline 2955 2955 OldLines[i++] = runner->second->lines[j]; 2956 Log() << Verbose(0) << *runner->second->lines[j] << "\t";2956 DoLog(0) && (Log() << Verbose(0) << *runner->second->lines[j] << "\t"); 2957 2957 } 2958 Log() << Verbose(0) << endl;2959 Log() << Verbose(0) << "The two old points are: ";2958 DoLog(0) && (Log() << Verbose(0) << endl); 2959 DoLog(0) && (Log() << Verbose(0) << "The two old points are: "); 2960 2960 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2961 2961 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 2962 2962 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) { // and neither of its endpoints 2963 2963 OldPoints[m++] = runner->second->endpoints[j]; 2964 Log() << Verbose(0) << *runner->second->endpoints[j] << "\t";2964 DoLog(0) && (Log() << Verbose(0) << *runner->second->endpoints[j] << "\t"); 2965 2965 } 2966 Log() << Verbose(0) << endl;2966 DoLog(0) && (Log() << Verbose(0) << endl); 2967 2967 2968 2968 // check whether everything is in place to create new lines and triangles … … 2983 2983 2984 2984 // remove triangles and baseline removes itself 2985 Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;2985 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl); 2986 2986 OldBaseLineNr = Base->Nr; 2987 2987 m = 0; 2988 2988 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2989 Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;2989 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl); 2990 2990 OldTriangleNrs[m++] = runner->second->Nr; 2991 2991 RemoveTesselationTriangle(runner->second); … … 2997 2997 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 2998 2998 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 2999 Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl;2999 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl); 3000 3000 3001 3001 // construct new triangles with flipped baseline … … 3012 3012 BTS->GetNormalVector(BaseLineNormal); 3013 3013 AddTesselationTriangle(OldTriangleNrs[0]); 3014 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;3014 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl); 3015 3015 3016 3016 BLS[0] = (i == 2 ? OldLines[3] : OldLines[2]); … … 3020 3020 BTS->GetNormalVector(BaseLineNormal); 3021 3021 AddTesselationTriangle(OldTriangleNrs[1]); 3022 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;3022 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl); 3023 3023 } else { 3024 3024 DoeLog(0) && (eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl); … … 3061 3061 Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1; 3062 3062 } 3063 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;3063 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); 3064 3064 3065 3065 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) … … 3099 3099 if (angle < Storage[0]) { 3100 3100 //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 3101 Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";3101 DoLog(1) && (Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"); 3102 3102 OptCandidate = Candidate; 3103 3103 Storage[0] = angle; … … 3114 3114 } 3115 3115 } else { 3116 Log() << Verbose(0) << "Linked cell list is empty." << endl;3116 DoLog(0) && (Log() << Verbose(0) << "Linked cell list is empty." << endl); 3117 3117 } 3118 3118 } … … 3169 3169 TesselPoint *Candidate = NULL; 3170 3170 3171 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;3171 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl); 3172 3172 3173 3173 // copy old center … … 3193 3193 CircleRadius = RADIUS * RADIUS - radius; 3194 3194 CirclePlaneNormal.Normalize(); 3195 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;3195 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl); 3196 3196 3197 3197 // test whether old center is on the band's plane … … 3202 3202 radius = RelativeOldSphereCenter.NormSquared(); 3203 3203 if (fabs(radius - CircleRadius) < HULLEPSILON) { 3204 Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl;3204 DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl); 3205 3205 3206 3206 // check SearchDirection 3207 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;3207 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl); 3208 3208 if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 3209 3209 DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl); … … 3237 3237 3238 3238 // check for three unique points 3239 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl;3239 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl); 3240 3240 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node)) { 3241 3241 3242 3242 // find center on the plane 3243 3243 GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node); 3244 Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;3244 DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl); 3245 3245 3246 3246 if (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node) && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON)) { 3247 Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;3247 DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl); 3248 3248 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter); 3249 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;3250 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;3251 Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl;3249 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl); 3250 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl); 3251 DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl); 3252 3252 if (radius < RADIUS * RADIUS) { 3253 3253 otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter); … … 3260 3260 helper.CopyVector(&NewNormalVector); 3261 3261 helper.Scale(sqrt(RADIUS * RADIUS - radius)); 3262 Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl;3262 DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl); 3263 3263 NewSphereCenter.AddVector(&helper); 3264 Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;3264 DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl); 3265 3265 // OtherNewSphereCenter is created by the same vector just in the other direction 3266 3266 helper.Scale(-1.); 3267 3267 OtherNewSphereCenter.AddVector(&helper); 3268 Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;3268 DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl); 3269 3269 3270 3270 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); … … 3285 3285 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 3286 3286 CandidateLine.pointlist.push_back(Candidate); 3287 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;3287 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl); 3288 3288 } else { 3289 3289 // remove all candidates from the list and then the list itself 3290 3290 CandidateLine.pointlist.clear(); 3291 3291 CandidateLine.pointlist.push_back(Candidate); 3292 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;3292 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl); 3293 3293 } 3294 3294 CandidateLine.ShortestAngle = alpha; 3295 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;3295 DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl); 3296 3296 } else { 3297 3297 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 3298 Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;3298 DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl); 3299 3299 } else { 3300 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;3300 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl); 3301 3301 } 3302 3302 } 3303 3303 } else { 3304 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;3304 DoLog(1) && (Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl); 3305 3305 } 3306 3306 } else { 3307 Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;3307 DoLog(1) && (Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl); 3308 3308 } 3309 3309 } else { 3310 3310 if (ThirdPoint != NULL) { 3311 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl;3311 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl); 3312 3312 } else { 3313 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;3313 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl); 3314 3314 } 3315 3315 } … … 3322 3322 } else { 3323 3323 if (ThirdPoint != NULL) 3324 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl;3324 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl); 3325 3325 else 3326 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl;3326 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl); 3327 3327 } 3328 3328 … … 3358 3358 if (!OrderTest.second) { // if insertion fails, we have common endpoint 3359 3359 node = OrderTest.first->second; 3360 Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl;3360 DoLog(1) && (Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl); 3361 3361 j = 2; 3362 3362 i = 2; … … 3388 3388 for (int i = 0; i < NDIM; i++) // store indices of this cell 3389 3389 N[i] = LC->n[i]; 3390 Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;3390 DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl); 3391 3391 DistanceToPointMap * points = new DistanceToPointMap; 3392 3392 LC->GetNeighbourBounds(Nlower, Nupper); … … 3402 3402 if (FindPoint != PointsOnBoundary.end()) { 3403 3403 points->insert(DistanceToPointPair(FindPoint->second->node->node->DistanceSquared(x), FindPoint->second)); 3404 Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl;3404 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl); 3405 3405 } 3406 3406 } … … 3436 3436 3437 3437 // for each point, check its lines, remember closest 3438 Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl;3438 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl); 3439 3439 BoundaryLineSet *ClosestLine = NULL; 3440 3440 double MinDistance = -1.; … … 3467 3467 ClosestLine = LineRunner->second; 3468 3468 MinDistance = distance; 3469 Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl;3469 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl); 3470 3470 } else { 3471 Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl;3471 DoLog(1) && (Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl); 3472 3472 } 3473 3473 } else { 3474 Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl;3474 DoLog(1) && (Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl); 3475 3475 } 3476 3476 } … … 3479 3479 // check whether closest line is "too close" :), then it's inside 3480 3480 if (ClosestLine == NULL) { 3481 Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;3481 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl); 3482 3482 return NULL; 3483 3483 } … … 3502 3502 3503 3503 // for each point, check its lines, remember closest 3504 Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl;3504 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl); 3505 3505 LineSet ClosestLines; 3506 3506 double MinDistance = 1e+16; … … 3530 3530 ClosestLines.insert(LineRunner->second); 3531 3531 MinDistance = lengthEnd; 3532 Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl;3532 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl); 3533 3533 } else if (fabs(lengthEnd - MinDistance) < MYEPSILON) { // additional best candidate 3534 3534 ClosestLines.insert(LineRunner->second); 3535 Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl;3535 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl); 3536 3536 } else { // line is worse 3537 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;3537 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); 3538 3538 } 3539 3539 } else { // intersection is closer, calculate … … 3551 3551 ClosestLines.insert(LineRunner->second); 3552 3552 MinDistance = distance; 3553 Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl;3553 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl); 3554 3554 } else { 3555 Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl;3555 DoLog(2) && (Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl); 3556 3556 } 3557 3557 } … … 3562 3562 // check whether closest line is "too close" :), then it's inside 3563 3563 if (ClosestLines.empty()) { 3564 Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;3564 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl); 3565 3565 return NULL; 3566 3566 } … … 3603 3603 result = *Runner; 3604 3604 MinAlignment = Alignment; 3605 Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl;3605 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl); 3606 3606 } else { 3607 Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl;3607 DoLog(1) && (Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl); 3608 3608 } 3609 3609 } … … 3658 3658 3659 3659 if (triangle == NULL) {// is boundary point or only point in point cloud? 3660 Log() << Verbose(1) << "No triangle given!" << endl;3660 DoLog(1) && (Log() << Verbose(1) << "No triangle given!" << endl); 3661 3661 return -1.; 3662 3662 } else { 3663 Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl;3663 DoLog(1) && (Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl); 3664 3664 } 3665 3665 3666 3666 triangle->GetCenter(&Center); 3667 Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl;3667 DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl); 3668 3668 DistanceToCenter.CopyVector(&Center); 3669 3669 DistanceToCenter.SubtractVector(&Point); 3670 Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl;3670 DoLog(2) && (Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl); 3671 3671 3672 3672 // check whether we are on boundary … … 3677 3677 Center.SubtractVector(&triangle->NormalVector); // points towards MolCenter 3678 3678 DistanceToCenter.AddVector(&triangle->NormalVector); // points outside 3679 Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl;3679 DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl); 3680 3680 if (triangle->GetIntersectionInsideTriangle(&Center, &DistanceToCenter, &Intersection)) { 3681 Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl;3681 DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl); 3682 3682 return 0.; 3683 3683 } else { 3684 Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl;3684 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl); 3685 3685 return false; 3686 3686 } … … 3688 3688 // calculate smallest distance 3689 3689 distance = triangle->GetClosestPointInsideTriangle(&Point, &Intersection); 3690 Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl;3690 DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl); 3691 3691 3692 3692 // then check direction to boundary 3693 3693 if (DistanceToCenter.ScalarProduct(&triangle->NormalVector) > MYEPSILON) { 3694 Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl;3694 DoLog(1) && (Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl); 3695 3695 return -distance; 3696 3696 } else { 3697 Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl;3697 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl); 3698 3698 return +distance; 3699 3699 } … … 3775 3775 3776 3776 if (takePoint) { 3777 Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;3777 DoLog(1) && (Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl); 3778 3778 connectedPoints->insert(current); 3779 3779 } … … 3831 3831 } 3832 3832 PlaneNormal.Scale(1.0 / triangles->size()); 3833 Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl;3833 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl); 3834 3834 PlaneNormal.Normalize(); 3835 3835 … … 3841 3841 } 3842 3842 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) { 3843 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;3843 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl); 3844 3844 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 3845 3845 AngleZero.SubtractVector(Point->node); … … 3850 3850 } 3851 3851 } 3852 Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;3852 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl); 3853 3853 if (AngleZero.NormSquared() > MYEPSILON) 3854 3854 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 3855 3855 else 3856 3856 OrthogonalVector.MakeNormalVector(&PlaneNormal); 3857 Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;3857 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl); 3858 3858 3859 3859 // go through all connected points and calculate angle … … 3863 3863 helper.ProjectOntoPlane(&PlaneNormal); 3864 3864 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 3865 Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;3865 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl); 3866 3866 anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 3867 3867 } … … 3909 3909 } 3910 3910 3911 Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl;3911 DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl); 3912 3912 // calculate central point 3913 3913 TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin(); … … 3920 3920 while (TesselC != SetOfNeighbours->end()) { 3921 3921 helper.MakeNormalVector((*TesselA)->node, (*TesselB)->node, (*TesselC)->node); 3922 Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl;3922 DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl); 3923 3923 counter++; 3924 3924 TesselA++; … … 3936 3936 // PlaneNormal.SubtractVector(¢er); 3937 3937 // PlaneNormal.Normalize(); 3938 Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;3938 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl); 3939 3939 3940 3940 // construct one orthogonal vector … … 3945 3945 } 3946 3946 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) { 3947 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;3947 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl); 3948 3948 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 3949 3949 AngleZero.SubtractVector(Point->node); … … 3954 3954 } 3955 3955 } 3956 Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;3956 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl); 3957 3957 if (AngleZero.NormSquared() > MYEPSILON) 3958 3958 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 3959 3959 else 3960 3960 OrthogonalVector.MakeNormalVector(&PlaneNormal); 3961 Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;3961 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl); 3962 3962 3963 3963 // go through all connected points and calculate angle … … 3970 3970 if (angle > M_PI) // the correction is of no use here (and not desired) 3971 3971 angle = 2. * M_PI - angle; 3972 Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl;3972 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl); 3973 3973 InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 3974 3974 if (!InserterTest.second) { … … 4037 4037 StartLine = CurrentLine; 4038 4038 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 4039 Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;4039 DoLog(1) && (Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl); 4040 4040 do { 4041 4041 // push current one 4042 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;4042 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl); 4043 4043 connectedPath->push_back(CurrentPoint->node); 4044 4044 4045 4045 // find next triangle 4046 4046 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 4047 Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;4047 DoLog(1) && (Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl); 4048 4048 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 4049 4049 triangle = Runner->second; … … 4052 4052 if (!TriangleRunner->second) { 4053 4053 TriangleRunner->second = true; 4054 Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl;4054 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl); 4055 4055 break; 4056 4056 } else { 4057 Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;4057 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl); 4058 4058 triangle = NULL; 4059 4059 } … … 4070 4070 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 4071 4071 CurrentLine = triangle->lines[i]; 4072 Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;4072 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl); 4073 4073 break; 4074 4074 } … … 4084 4084 } while (CurrentLine != StartLine); 4085 4085 // last point is missing, as it's on start line 4086 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;4086 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl); 4087 4087 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 4088 4088 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 4090 4090 ListOfPaths->push_back(connectedPath); 4091 4091 } else { 4092 Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;4092 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl); 4093 4093 } 4094 4094 } … … 4120 4120 connectedPath = *ListRunner; 4121 4121 4122 Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl;4122 DoLog(1) && (Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl); 4123 4123 4124 4124 // go through list, look for reappearance of starting Point and count … … 4129 4129 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 4130 4130 // we have a closed circle from Marker to new Marker 4131 Log() << Verbose(1) << count + 1 << ". closed path consists of: ";4131 DoLog(1) && (Log() << Verbose(1) << count + 1 << ". closed path consists of: "); 4132 4132 newPath = new TesselPointList; 4133 4133 TesselPointList::iterator CircleSprinter = Marker; 4134 4134 for (; CircleSprinter != CircleRunner; CircleSprinter++) { 4135 4135 newPath->push_back(*CircleSprinter); 4136 Log() << Verbose(0) << (**CircleSprinter) << " <-> ";4136 DoLog(0) && (Log() << Verbose(0) << (**CircleSprinter) << " <-> "); 4137 4137 } 4138 Log() << Verbose(0) << ".." << endl;4138 DoLog(0) && (Log() << Verbose(0) << ".." << endl); 4139 4139 count++; 4140 4140 Marker = CircleRunner; … … 4145 4145 } 4146 4146 } 4147 Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl;4147 DoLog(1) && (Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl); 4148 4148 4149 4149 // delete list of paths … … 4207 4207 return 0.; 4208 4208 } else 4209 Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl;4209 DoLog(0) && (Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl); 4210 4210 4211 4211 // copy old location for the volume … … 4237 4237 NormalVector.Zero(); 4238 4238 for (TriangleMap::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 4239 Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl;4239 DoLog(1) && (Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl); 4240 4240 NormalVector.SubtractVector(&Runner->second->NormalVector); // has to point inward 4241 4241 RemoveTesselationTriangle(Runner->second); 4242 4242 count++; 4243 4243 } 4244 Log() << Verbose(1) << count << " triangles were removed." << endl;4244 DoLog(1) && (Log() << Verbose(1) << count << " triangles were removed." << endl); 4245 4245 4246 4246 list<TesselPointList *>::iterator ListAdvance = ListOfClosedPaths->begin(); … … 4266 4266 smallestangle = 0.; 4267 4267 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 4268 Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;4268 DoLog(1) && (Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl); 4269 4269 // construct vectors to next and previous neighbour 4270 4270 StartNode = MiddleNode; … … 4304 4304 if (EndNode == connectedPath->end()) 4305 4305 EndNode = connectedPath->begin(); 4306 Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl;4307 Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;4308 Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl;4309 Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;4306 DoLog(2) && (Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl); 4307 DoLog(2) && (Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl); 4308 DoLog(2) && (Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl); 4309 DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl); 4310 4310 TriangleCandidates[0] = *StartNode; 4311 4311 TriangleCandidates[1] = *MiddleNode; … … 4325 4325 continue; 4326 4326 } 4327 Log() << Verbose(3) << "Adding new triangle points." << endl;4327 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle points." << endl); 4328 4328 AddTesselationPoint(*StartNode, 0); 4329 4329 AddTesselationPoint(*MiddleNode, 1); 4330 4330 AddTesselationPoint(*EndNode, 2); 4331 Log() << Verbose(3) << "Adding new triangle lines." << endl;4331 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle lines." << endl); 4332 4332 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 4333 4333 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 4344 4344 // prepare nodes for next triangle 4345 4345 StartNode = EndNode; 4346 Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;4346 DoLog(2) && (Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl); 4347 4347 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 4348 4348 if (connectedPath->size() == 2) { // we are done … … 4380 4380 if (maxgain != 0) { 4381 4381 volume += maxgain; 4382 Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;4382 DoLog(1) && (Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl); 4383 4383 OtherBase = FlipBaseline(*Candidate); 4384 4384 NewLines.erase(Candidate); … … 4391 4391 delete (connectedPath); 4392 4392 } 4393 Log() << Verbose(0) << count << " triangles were created." << endl;4393 DoLog(0) && (Log() << Verbose(0) << count << " triangles were created." << endl); 4394 4394 } else { 4395 4395 while (!ListOfClosedPaths->empty()) { … … 4399 4399 delete (connectedPath); 4400 4400 } 4401 Log() << Verbose(0) << "No need to create any triangles." << endl;4401 DoLog(0) && (Log() << Verbose(0) << "No need to create any triangles." << endl); 4402 4402 } 4403 4403 delete (ListOfClosedPaths); 4404 4404 4405 Log() << Verbose(0) << "Removed volume is " << volume << "." << endl;4405 DoLog(0) && (Log() << Verbose(0) << "Removed volume is " << volume << "." << endl); 4406 4406 4407 4407 return volume; … … 4568 4568 AllLines.clear(); 4569 4569 4570 Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;4570 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl); 4571 4571 IndexToIndex::iterator it; 4572 4572 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) { … … 4574 4574 const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second); 4575 4575 if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end()) 4576 Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl;4576 DoLog(0) && (Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl); 4577 4577 else 4578 4578 DoeLog(1) && (eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl); … … 4616 4616 delete (DegeneratedLines); 4617 4617 4618 Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;4618 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl); 4619 4619 IndexToIndex::iterator it; 4620 4620 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 4621 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;4621 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl); 4622 4622 4623 4623 return DegeneratedTriangles; … … 4687 4687 // erase the pair 4688 4688 count += (int) DegeneratedTriangles->erase(triangle->Nr); 4689 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;4689 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl); 4690 4690 RemoveTesselationTriangle(triangle); 4691 4691 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 4692 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;4692 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl); 4693 4693 RemoveTesselationTriangle(partnerTriangle); 4694 4694 } else { 4695 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;4695 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); 4696 4696 } 4697 4697 } … … 4700 4700 LastTriangle = NULL; 4701 4701 4702 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;4702 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl); 4703 4703 } 4704 4704 … … 4729 4729 return; 4730 4730 } 4731 Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;4731 DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl); 4732 4732 4733 4733 // go through its lines and find the best one to split … … 4762 4762 4763 4763 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 4764 Log() << Verbose(2) << "Adding new triangle points." << endl;4764 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl); 4765 4765 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 4766 4766 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 4767 4767 AddTesselationPoint(point, 2); 4768 Log() << Verbose(2) << "Adding new triangle lines." << endl;4768 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl); 4769 4769 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 4770 4770 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 4773 4773 BTS->GetNormalVector(TempTriangle->NormalVector); 4774 4774 BTS->NormalVector.Scale(-1.); 4775 Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;4775 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl); 4776 4776 AddTesselationTriangle(); 4777 4777 4778 4778 // create other side of this triangle and close both new sides of the first created triangle 4779 Log() << Verbose(2) << "Adding new triangle points." << endl;4779 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl); 4780 4780 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 4781 4781 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 4782 4782 AddTesselationPoint(point, 2); 4783 Log() << Verbose(2) << "Adding new triangle lines." << endl;4783 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl); 4784 4784 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 4785 4785 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 4787 4787 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 4788 4788 BTS->GetNormalVector(TempTriangle->NormalVector); 4789 Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;4789 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl); 4790 4790 AddTesselationTriangle(); 4791 4791 … … 4825 4825 NameofTempFile.erase(npos, 1); 4826 4826 NameofTempFile.append(TecplotSuffix); 4827 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";4827 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"); 4828 4828 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 4829 4829 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 4839 4839 NameofTempFile.erase(npos, 1); 4840 4840 NameofTempFile.append(Raster3DSuffix); 4841 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";4841 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"); 4842 4842 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 4843 4843 WriteRaster3dFile(tempstream, this, cloud); … … 4891 4891 pair<map<int, Vector *>::iterator, bool> TriangleInsertionTester; 4892 4892 for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) { 4893 Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl;4893 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl); 4894 4894 map<int, Vector *> TriangleVectors; 4895 4895 // gather all NormalVectors 4896 Log() << Verbose(1) << "Gathering triangles ..." << endl;4896 DoLog(1) && (Log() << Verbose(1) << "Gathering triangles ..." << endl); 4897 4897 for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++) 4898 4898 for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) { … … 4900 4900 TriangleInsertionTester = TriangleVectors.insert(pair<int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector))); 4901 4901 if (TriangleInsertionTester.second) 4902 Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;4902 DoLog(1) && (Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl); 4903 4903 } else { 4904 Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl;4904 DoLog(1) && (Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl); 4905 4905 } 4906 4906 } 4907 4907 // check whether there are two that are parallel 4908 Log() << Verbose(1) << "Finding two parallel triangles ..." << endl;4908 DoLog(1) && (Log() << Verbose(1) << "Finding two parallel triangles ..." << endl); 4909 4909 for (map<int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++) 4910 4910 for (map<int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++) 4911 4911 if (VectorWalker != VectorRunner) { // skip equals 4912 4912 const double SCP = VectorWalker->second->ScalarProduct(VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles 4913 Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl;4913 DoLog(1) && (Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl); 4914 4914 if (fabs(SCP + 1.) < ParallelEpsilon) { 4915 4915 InsertionTester = EndpointCandidateList.insert((Runner->second)); 4916 4916 if (InsertionTester.second) 4917 Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl;4917 DoLog(0) && (Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl); 4918 4918 // and break out of both loops 4919 4919 VectorWalker = TriangleVectors.end(); … … 4933 4933 Walker = *(EndpointCandidateList.begin()); 4934 4934 if (Current == NULL) { // create a new polygon with current candidate 4935 Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl;4935 DoLog(0) && (Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl); 4936 4936 Current = new BoundaryPolygonSet; 4937 4937 Current->endpoints.insert(Walker); … … 4946 4946 for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) { 4947 4947 OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker); 4948 Log() << Verbose(1) << "Checking " << *OtherWalker << endl;4948 DoLog(1) && (Log() << Verbose(1) << "Checking " << *OtherWalker << endl); 4949 4949 set<BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker); 4950 4950 if (Finder != EndpointCandidateList.end()) { // found a connected partner 4951 Log() << Verbose(1) << " Adding to polygon." << endl;4951 DoLog(1) && (Log() << Verbose(1) << " Adding to polygon." << endl); 4952 4952 Current->endpoints.insert(OtherWalker); 4953 4953 EndpointCandidateList.erase(Finder); // remove from candidates 4954 4954 ToCheckConnecteds.push(OtherWalker); // but check its partners too 4955 4955 } else { 4956 Log() << Verbose(1) << " is not connected to " << *Walker << endl;4956 DoLog(1) && (Log() << Verbose(1) << " is not connected to " << *Walker << endl); 4957 4957 } 4958 4958 } 4959 4959 } 4960 4960 4961 Log() << Verbose(0) << "Final polygon is " << *Current << endl;4961 DoLog(0) && (Log() << Verbose(0) << "Final polygon is " << *Current << endl); 4962 4962 ListofDegeneratedPolygons.insert(Current); 4963 4963 Current = NULL; … … 4966 4966 const int counter = ListofDegeneratedPolygons.size(); 4967 4967 4968 Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl;4968 DoLog(0) && (Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl); 4969 4969 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 4970 Log() << Verbose(0) << " " << **PolygonRunner << endl;4970 DoLog(0) && (Log() << Verbose(0) << " " << **PolygonRunner << endl); 4971 4971 4972 4972 /// 4. Go through all these degenerated polygons … … 4979 4979 // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do. 4980 4980 if (T->size() == 2) { 4981 Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;4981 DoLog(1) && (Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl); 4982 4982 delete (T); 4983 4983 continue; … … 4995 4995 /// 4a. Get NormalVector for one side (this is "front") 4996 4996 NormalVector.CopyVector(&(*TriangleWalker)->NormalVector); 4997 Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl;4997 DoLog(1) && (Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl); 4998 4998 TriangleWalker++; 4999 4999 TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator … … 5004 5004 triangle = *TriangleWalker; 5005 5005 TriangleSprinter++; 5006 Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl;5006 DoLog(1) && (Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl); 5007 5007 if (triangle->NormalVector.ScalarProduct(&NormalVector) < 0) { // if from other side, then delete and remove from list 5008 Log() << Verbose(1) << " Removing ... " << endl;5008 DoLog(1) && (Log() << Verbose(1) << " Removing ... " << endl); 5009 5009 TriangleNrs.push(triangle->Nr); 5010 5010 T->erase(TriangleWalker); 5011 5011 RemoveTesselationTriangle(triangle); 5012 5012 } else 5013 Log() << Verbose(1) << " Keeping ... " << endl;5013 DoLog(1) && (Log() << Verbose(1) << " Keeping ... " << endl); 5014 5014 } 5015 5015 /// 4c. Copy all "front" triangles but with inverse NormalVector 5016 5016 TriangleWalker = T->begin(); 5017 5017 while (TriangleWalker != T->end()) { // go through all front triangles 5018 Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl;5018 DoLog(1) && (Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl); 5019 5019 for (int i = 0; i < 3; i++) 5020 5020 AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i); … … 5037 5037 } 5038 5038 IndexToIndex * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles(); 5039 Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl;5039 DoLog(0) && (Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl); 5040 5040 IndexToIndex::iterator it; 5041 5041 for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++) 5042 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;5042 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl); 5043 5043 delete (SimplyDegeneratedTriangles); 5044 5044 /// 5. exit
Note:
See TracChangeset
for help on using the changeset viewer.