Changeset 47d041 for src/Tesselation
- Timestamp:
- Nov 3, 2011, 7:44:01 PM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 41a467
- Parents:
- 50e4e5
- git-author:
- Frederik Heber <heber@…> (10/27/11 11:53:58)
- git-committer:
- Frederik Heber <heber@…> (11/03/11 19:44:01)
- Location:
- src/Tesselation
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tesselation/BoundaryLineSet.cpp
r50e4e5 r47d041 66 66 skipped = false; 67 67 // clear triangles list 68 DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);68 LOG(0, "New Line with endpoints " << *this << "."); 69 69 } 70 70 ; … … 87 87 Point2->AddLine(this); // 88 88 // clear triangles list 89 DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);89 LOG(0, "New Line with endpoints " << *this << "."); 90 90 } 91 91 ; … … 116 116 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 117 117 if ((*Runner).second == this) { 118 //L og() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;118 //LOG(0, "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "."); 119 119 endpoints[i]->lines.erase(Runner); 120 120 break; … … 122 122 } else { // there's just a single line left 123 123 if (endpoints[i]->lines.erase(Nr)) { 124 //L og() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;124 //LOG(0, "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "."); 125 125 } 126 126 } 127 127 if (endpoints[i]->lines.empty()) { 128 //L og() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;128 //LOG(0, *endpoints[i] << " has no more lines it's attached to, erasing."); 129 129 if (endpoints[i] != NULL) { 130 130 delete (endpoints[i]); … … 135 135 } 136 136 if (!triangles.empty()) 137 DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);137 ELOG(2, "Memory Leak! I " << *this << " am still connected to some triangles."); 138 138 } 139 139 ; … … 145 145 { 146 146 Info FunctionInfo(__func__); 147 DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);147 LOG(0, "Add " << triangle->Nr << " to line " << *this << "."); 148 148 triangles.insert(TrianglePair(triangle->Nr, triangle)); 149 149 } … … 175 175 double angle = CalculateConvexity(); 176 176 if (angle > -MYEPSILON) { 177 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);177 LOG(0, "ACCEPT: Angle is greater than pi: convex."); 178 178 return true; 179 179 } else { 180 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);180 LOG(0, "REJECT: Angle is less than pi: concave."); 181 181 return false; 182 182 } … … 194 194 // get the two triangles 195 195 if (triangles.size() != 2) { 196 DoeLog(0) && (eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);196 ELOG(0, "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!"); 197 197 return true; 198 198 } 199 199 // check normal vectors 200 200 // have a normal vector on the base line pointing outwards 201 //L og() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;201 //LOG(0, "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "."); 202 202 BaseLineCenter = (1./2.)*((endpoints[0]->node->getPosition()) + (endpoints[1]->node->getPosition())); 203 203 BaseLine = (endpoints[0]->node->getPosition()) - (endpoints[1]->node->getPosition()); 204 204 205 //L og() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;205 //LOG(0, "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "."); 206 206 207 207 BaseLineNormal.Zero(); … … 211 211 class BoundaryPointSet *node = NULL; 212 212 for (TriangleMap::const_iterator runner = triangles.begin(); runner != triangles.end(); runner++) { 213 //L og() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;213 //LOG(0, "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "."); 214 214 NormalCheck += runner->second->NormalVector; 215 215 NormalCheck *= sign; … … 218 218 BaseLineNormal = runner->second->NormalVector; // yes, copy second on top of first 219 219 else { 220 DoeLog(0) && (eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);220 ELOG(0, "Triangle " << *runner->second << " has zero normal vector!"); 221 221 } 222 222 node = runner->second->GetThirdEndpoint(this); 223 223 if (node != NULL) { 224 //L og() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;224 //LOG(0, "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "."); 225 225 helper[i] = (node->node->getPosition()) - BaseLineCenter; 226 226 helper[i].MakeNormalTo(BaseLine); // we want to compare the triangle's heights' angles! 227 //L og() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;227 //LOG(0, "INFO: Height vector with respect to baseline is " << helper[i] << "."); 228 228 i++; 229 229 } else { 230 DoeLog(1) && (eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);230 ELOG(1, "I cannot find third node in triangle, something's wrong."); 231 231 return true; 232 232 } 233 233 } 234 //L og() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;234 //LOG(0, "INFO: BaselineNormal is " << BaseLineNormal << "."); 235 235 if (NormalCheck.NormSquared() < MYEPSILON) { 236 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);236 LOG(0, "ACCEPT: Normalvectors of both triangles are the same: convex."); 237 237 return true; 238 238 } -
src/Tesselation/BoundaryPointSet.cpp
r50e4e5 r47d041 46 46 { 47 47 Info FunctionInfo(__func__); 48 DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);48 LOG(1, "Adding noname."); 49 49 } 50 50 ; … … 60 60 { 61 61 Info FunctionInfo(__func__); 62 DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);62 LOG(1, "Adding Node " << *Walker); 63 63 } 64 64 ; … … 71 71 { 72 72 Info FunctionInfo(__func__); 73 //L og() << Verbose(0) << "Erasing point Nr. " << Nr << "." << endl;73 //LOG(0, "Erasing point Nr. " << Nr << "."); 74 74 if (!lines.empty()) 75 DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);75 ELOG(2, "Memory Leak! I " << *this << " am still connected to some lines."); 76 76 node = NULL; 77 77 } … … 84 84 { 85 85 Info FunctionInfo(__func__); 86 DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);86 LOG(1, "Adding " << *this << " to line " << *line << "."); 87 87 if (line->endpoints[0] == this) { 88 88 lines.insert(LinePair(line->endpoints[1]->Nr, line)); -
src/Tesselation/BoundaryPolygonSet.cpp
r50e4e5 r47d041 56 56 Info FunctionInfo(__func__); 57 57 endpoints.clear(); 58 DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);58 LOG(1, "Erasing polygon Nr." << Nr << " itself."); 59 59 } 60 60 ; … … 77 77 Runner[i]++; 78 78 if (Runner[i] == endpoints.end()) { 79 DoeLog(0) && (eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl);79 ELOG(0, "There are less than three endpoints in the polygon!"); 80 80 performCriticalExit(); 81 81 } … … 97 97 if (TotalNormal->ScalarProduct(OtherVector) > 0.) 98 98 TotalNormal->Scale(-1.); 99 DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);99 LOG(1, "Normal Vector is " << *TotalNormal << "."); 100 100 101 101 return TotalNormal; … … 117 117 } 118 118 center->Scale(1. / (double) counter); 119 DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);119 LOG(1, "Center is at " << *center << "."); 120 120 } 121 121 … … 150 150 Info FunctionInfo(__func__); 151 151 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 152 DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);152 LOG(0, "Checking against " << **Runner); 153 153 if (point == (*Runner)) { 154 DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);154 LOG(0, " Contained."); 155 155 return true; 156 156 } 157 157 } 158 DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);158 LOG(0, " Not contained."); 159 159 return false; 160 160 } … … 170 170 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) 171 171 if (point == (*Runner)->node) { 172 DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);172 LOG(0, " Contained."); 173 173 return true; 174 174 } 175 DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);175 LOG(0, " Not contained."); 176 176 return false; 177 177 } … … 187 187 Info FunctionInfo(__func__); 188 188 int counter = 0; 189 DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);189 LOG(1, "Polygon is " << *this); 190 190 for (int i = 0; i < dim; i++) { 191 DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);191 LOG(1, " Testing endpoint " << *Points[i]); 192 192 if (ContainsBoundaryPoint(Points[i])) { 193 193 counter++; … … 210 210 Info FunctionInfo(__func__); 211 211 size_t counter = 0; 212 DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);212 LOG(1, "Polygon is " << *this); 213 213 for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 214 DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);214 LOG(1, " Testing endpoint " << **Runner); 215 215 if (ContainsBoundaryPoint(*Runner)) 216 216 counter++; … … 246 246 for (LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++) 247 247 for (TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) { 248 //L og() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;248 //LOG(0, " Testing triangle " << *(Sprinter->second)); 249 249 if (ContainsBoundaryTriangle(Sprinter->second)) { 250 250 Tester = triangles->insert(Sprinter->second); 251 251 if (Tester.second) 252 DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);252 LOG(0, "Adding triangle " << *(Sprinter->second)); 253 253 } 254 254 } 255 255 256 DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);256 LOG(1, "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total."); 257 257 return triangles; 258 258 } … … 269 269 if (line == NULL) 270 270 return false; 271 DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);271 LOG(1, "Filling polygon from line " << *line); 272 272 for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) { 273 273 for (int i = 0; i < 3; i++) { 274 274 Tester = endpoints.insert((Runner->second)->endpoints[i]); 275 275 if (Tester.second) 276 DoLog(1) && (Log() << Verbose(1) << " Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);276 LOG(1, " Inserting endpoint " << *((Runner->second)->endpoints[i])); 277 277 } 278 278 } -
src/Tesselation/BoundaryTriangleSet.cpp
r50e4e5 r47d041 79 79 // set endpoints 80 80 int Counter = 0; 81 DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);81 LOG(0, "New triangle " << Nr << " with end points: "); 82 82 for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) { 83 83 endpoints[Counter] = runner->second; 84 DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);84 LOG(0, " " << *endpoints[Counter]); 85 85 Counter++; 86 86 } … … 99 99 if (lines[i] != NULL) { 100 100 if (lines[i]->triangles.erase(Nr)) { 101 //L og() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;101 //LOG(0, "Triangle Nr." << Nr << " erased in line " << *lines[i] << "."); 102 102 } 103 103 if (lines[i]->triangles.empty()) { 104 //L og() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;104 //LOG(0, *lines[i] << " is no more attached to any triangle, erasing."); 105 105 delete (lines[i]); 106 106 lines[i] = NULL; … … 108 108 } 109 109 } 110 //L og() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;110 //LOG(0, "Erasing triangle Nr." << Nr << " itself."); 111 111 } 112 112 ; … … 127 127 if (NormalVector.ScalarProduct(OtherVector) > 0.) 128 128 NormalVector.Scale(-1.); 129 DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);129 LOG(1, "Normal Vector is " << NormalVector << "."); 130 130 } 131 131 ; … … 154 154 Intersection = Plane(NormalVector, (endpoints[0]->node->getPosition())).GetIntersection(centerLine); 155 155 156 DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);157 DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << MolCenter << " to " << x << "." << endl);158 DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << Intersection << "." << endl);156 LOG(1, "INFO: Triangle is " << *this << "."); 157 LOG(1, "INFO: Line is from " << MolCenter << " to " << x << "."); 158 LOG(1, "INFO: Intersection is " << Intersection << "."); 159 159 160 160 if (Intersection.DistanceSquared(endpoints[0]->node->getPosition()) < MYEPSILON) { 161 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);161 LOG(1, "Intersection coindices with first endpoint."); 162 162 return true; 163 163 } else if (Intersection.DistanceSquared(endpoints[1]->node->getPosition()) < MYEPSILON) { 164 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);164 LOG(1, "Intersection coindices with second endpoint."); 165 165 return true; 166 166 } else if (Intersection.DistanceSquared(endpoints[2]->node->getPosition()) < MYEPSILON) { 167 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);167 LOG(1, "Intersection coindices with third endpoint."); 168 168 return true; 169 169 } … … 177 177 CrossPoint -= (endpoints[i%3]->node->getPosition()); // cross point was returned as absolute vector 178 178 const double s = CrossPoint.ScalarProduct(helper)/helper.NormSquared(); 179 DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);179 LOG(1, "INFO: Factor s is " << s << "."); 180 180 if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) { 181 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);181 LOG(1, "INFO: Crosspoint " << CrossPoint << "outside of triangle."); 182 182 return false; 183 183 } 184 184 i++; 185 185 } while (i < 3); 186 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);186 LOG(1, "INFO: Crosspoint " << CrossPoint << " inside of triangle."); 187 187 return true; 188 188 } 189 189 catch (LinearAlgebraException &excp) { 190 L og() << Verbose(1) << boost::diagnostic_information(excp);191 DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);190 LOG(1, boost::diagnostic_information(excp)); 191 ELOG(1, "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!"); 192 192 return false; 193 193 } … … 213 213 214 214 // 1. get intersection with plane 215 DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << x << "." << endl);215 LOG(1, "INFO: Looking for closest point of triangle " << *this << " to " << x << "."); 216 216 GetCenter(Direction); 217 217 try { … … 228 228 InPlane += ClosestPoint; 229 229 230 DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);231 DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << x << "." << endl);232 DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);230 LOG(2, "INFO: Triangle is " << *this << "."); 231 LOG(2, "INFO: Line is from " << Direction << " to " << x << "."); 232 LOG(2, "INFO: In-plane part is " << InPlane << "."); 233 233 234 234 // Calculate cross point between one baseline and the desired point such that distance is shortest … … 247 247 CrossPoint[i] -= (endpoints[i%3]->node->getPosition()); // cross point was returned as absolute vector 248 248 const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared(); 249 DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);249 LOG(2, "INFO: Factor s is " << s << "."); 250 250 if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) { 251 251 CrossPoint[i] += (endpoints[i%3]->node->getPosition()); // make cross point absolute again 252 DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << endpoints[i % 3]->node->getPosition() << " and " << endpoints[(i + 1) % 3]->node->getPosition() << "." << endl);252 LOG(2, "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << endpoints[i % 3]->node->getPosition() << " and " << endpoints[(i + 1) % 3]->node->getPosition() << "."); 253 253 const double distance = CrossPoint[i].DistanceSquared(x); 254 254 if ((ShortestDistance < 0.) || (ShortestDistance > distance)) { … … 279 279 } 280 280 } 281 DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);281 LOG(1, "INFO: Closest Point is " << ClosestPoint << " with shortest squared distance is " << ShortestDistance << "."); 282 282 return ShortestDistance; 283 283 } … … 333 333 { 334 334 Info FunctionInfo(__func__); 335 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);335 LOG(1, "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "."); 336 336 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]) 337 337 … … 400 400 (center) += (endpoints[i]->node->getPosition()); 401 401 center.Scale(1. / 3.); 402 DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << center << "." << endl);402 LOG(1, "INFO: Center is at " << center << "."); 403 403 } 404 404 -
src/Tesselation/CandidateForTesselation.cpp
r50e4e5 r47d041 95 95 96 96 if (!pointlist.empty()) 97 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);97 LOG(1, "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..."); 98 98 else 99 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);99 LOG(1, "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..."); 100 100 // check baseline for OptCenter and OtherOptCenter being on sphere's surface 101 101 for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) { … … 103 103 const double distance = fabs((*VRunner)->DistanceSquared(BaseLine->endpoints[i]->node->getPosition()) - radiusSquared); 104 104 if (distance > HULLEPSILON) { 105 DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);105 ELOG(1, "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "."); 106 106 return false; 107 107 } … … 115 115 const double distance = fabs((*VRunner)->DistanceSquared(Walker->getPosition()) - radiusSquared); 116 116 if (distance > HULLEPSILON) { 117 DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);117 ELOG(1, "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "."); 118 118 return false; 119 119 } else { 120 DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);120 LOG(1, "Candidate " << *Walker << " is inside by " << distance << "."); 121 121 } 122 122 } 123 123 } 124 124 125 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);125 LOG(1, "INFO: Checking whether sphere contains no others points ..."); 126 126 bool flag = true; 127 127 for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) { … … 129 129 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner)); 130 130 131 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl);131 LOG(1, "The following atoms are inside sphere at " << (*VRunner) << ":"); 132 132 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 133 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->distance(*(*VRunner)) << "." << endl);133 LOG(1, " " << *(*Runner) << " with distance " << (*Runner)->distance(*(*VRunner)) << "."); 134 134 135 135 // remove baseline's endpoints and candidates 136 136 for (int i = 0; i < 2; i++) { 137 DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);137 LOG(1, "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "."); 138 138 ListofPoints->remove(BaseLine->endpoints[i]->node); 139 139 } 140 140 for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) { 141 DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);141 LOG(1, "INFO: removing candidate tesselpoint " << *(*Runner) << "."); 142 142 ListofPoints->remove(*Runner); 143 143 } 144 144 if (!ListofPoints->empty()) { 145 DoeLog(1) && (eLog() << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl);145 ELOG(1, "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere."); 146 146 flag = false; 147 DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl);147 ELOG(1, "External atoms inside of sphere at " << *(*VRunner) << ":"); 148 148 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 149 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->distance(*(*VRunner)) << setprecision(6) << "." << endl);149 ELOG(1, " " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->distance(*(*VRunner)) << setprecision(6) << "."); 150 150 151 151 // check with animate_sphere.tcl VMD script 152 152 if (ThirdPoint != NULL) { 153 DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);153 ELOG(1, "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2)); 154 154 } else { 155 DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl);156 DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);155 ELOG(1, "Check by: ... missing third point ..."); 156 ELOG(1, "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2)); 157 157 } 158 158 } -
src/Tesselation/boundary.cpp
r50e4e5 r47d041 84 84 } else { 85 85 BoundaryPoints = BoundaryPtr; 86 DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);86 LOG(0, "Using given boundary points set."); 87 87 } 88 88 // determine biggest "diameter" of cluster for each axis … … 91 91 for (int axis = 0; axis < NDIM; axis++) 92 92 { // regard each projected plane 93 //L og() << Verbose(1) << "Current axis is " << axis << "." << endl;93 //LOG(1, "Current axis is " << axis << "."); 94 94 for (int j = 0; j < 2; j++) 95 95 { // and for both axis on the current plane 96 96 component = (axis + j + 1) % NDIM; 97 97 Othercomponent = (axis + 1 + ((j + 1) & 1)) % NDIM; 98 //L og() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;98 //LOG(1, "Current component is " << component << ", Othercomponent is " << Othercomponent << "."); 99 99 for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 100 //L og() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;100 //LOG(1, "Current runner is " << *(runner->second.second) << "."); 101 101 // seek for the neighbours pair where the Othercomponent sign flips 102 102 Neighbour = runner; … … 111 111 Neighbour = BoundaryPoints[axis].begin(); 112 112 DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition()); 113 //L og() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;113 //LOG(2, "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "."); 114 114 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 115 115 OldComponent) - DistanceVector[Othercomponent] / fabs( … … 120 120 OtherNeighbour = BoundaryPoints[axis].end(); 121 121 OtherNeighbour--; 122 //L og() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;122 //LOG(1, "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "."); 123 123 // now we have found the pair: Neighbour and OtherNeighbour 124 124 OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition()); 125 //L og() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;126 //L og() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;125 //LOG(1, "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "."); 126 //LOG(1, "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "."); 127 127 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 128 128 w1 = fabs(OtherVector[Othercomponent]); … … 131 131 * OtherVector[component]) / (w1 + w2)); 132 132 // mark if it has greater diameter 133 //L og() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;133 //LOG(1, "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "."); 134 134 GreatestDiameter[component] = (GreatestDiameter[component] 135 135 > tmp) ? GreatestDiameter[component] : tmp; 136 136 } //else 137 //L og() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;137 //LOG(1, "Saw no sign flip, probably top or bottom node."); 138 138 } 139 139 } 140 140 } 141 L og() << Verbose(0) <<"RESULT: The biggest diameters are "141 LOG(0, "RESULT: The biggest diameters are " 142 142 << GreatestDiameter[0] << " and " << GreatestDiameter[1] << " and " 143 143 << GreatestDiameter[2] << " " << (IsAngstroem ? "angstrom" 144 : "atomiclength") << "." << endl;144 : "atomiclength") << "."); 145 145 146 146 // free reference lists … … 186 186 AngleReferenceNormalVector[(axis + 2) % NDIM] = 1.; 187 187 188 DoLog(1) && (Log() << Verbose(1) << "Axisvector is " << AxisVector << " and AngleReferenceVector is " << AngleReferenceVector << ", and AngleReferenceNormalVector is " << AngleReferenceNormalVector << "." << endl);188 LOG(1, "Axisvector is " << AxisVector << " and AngleReferenceVector is " << AngleReferenceVector << ", and AngleReferenceNormalVector is " << AngleReferenceNormalVector << "."); 189 189 190 190 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours … … 200 200 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 201 201 202 //L og() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;202 //LOG(1, "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "."); 203 203 if (ProjectedVector.ScalarProduct(AngleReferenceNormalVector) > 0) { 204 204 angle = 2. * M_PI - angle; 205 205 } 206 DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);206 LOG(1, "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector); 207 207 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter)))); 208 208 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity 209 DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);210 DoLog(2) && (Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl);211 DoLog(2) && (Log() << Verbose(2) << "New vector: " << **iter << endl);209 LOG(2, "Encountered two vectors whose projection onto axis " << axis << " is equal: "); 210 LOG(2, "Present vector: " << *BoundaryTestPair.first->second.second); 211 LOG(2, "New vector: " << **iter); 212 212 const double ProjectedVectorNorm = ProjectedVector.NormSquared(); 213 213 if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) { 214 214 BoundaryTestPair.first->second.first = ProjectedVectorNorm; 215 215 BoundaryTestPair.first->second.second = (*iter); 216 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);216 LOG(2, "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "."); 217 217 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { 218 218 helper = (*iter)->getPosition() - (*MolCenter); … … 221 221 if (helper.NormSquared() < oldhelperNorm) { 222 222 BoundaryTestPair.first->second.second = (*iter); 223 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl);223 LOG(2, "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "."); 224 224 } else { 225 DoLog(2) && (Log() << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "." << endl);225 LOG(2, "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "."); 226 226 } 227 227 } else { 228 DoLog(2) && (Log() << Verbose(2) << "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);228 LOG(2, "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "."); 229 229 } 230 230 } … … 232 232 // printing all inserted for debugging 233 233 // { 234 // Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 234 // std::stringstream output; 235 // output << "Printing list of candidates for axis " << axis << " which we have inserted so far: "; 235 236 // int i=0; 236 237 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 237 238 // if (runner != BoundaryPoints[axis].begin()) 238 // Log() << Verbose(0)<< ", " << i << ": " << *runner->second.second;239 // output << ", " << i << ": " << *runner->second.second; 239 240 // else 240 // Log() << Verbose(0)<< i << ": " << *runner->second.second;241 // output << i << ": " << *runner->second.second; 241 242 // i++; 242 243 // } 243 // L og() << Verbose(0) << endl;244 // LOG(1, output.str()); 244 245 // } 245 246 // 3c. throw out points whose distance is less than the mean of left and right neighbours 246 247 bool flag = false; 247 DoLog(1) && (Log() << Verbose(1) << "Looking for candidates to kick out by convex condition ... " << endl);248 LOG(1, "Looking for candidates to kick out by convex condition ... "); 248 249 do { // do as long as we still throw one out per round 249 250 flag = false; … … 273 274 SideA = left->second.second->getPosition() - (*MolCenter); 274 275 SideA.ProjectOntoPlane(AxisVector); 275 // L og() << Verbose(1) << "SideA: " << SideA << endl;276 // LOG(1, "SideA: " << SideA); 276 277 277 278 SideB = right->second.second->getPosition() -(*MolCenter); 278 279 SideB.ProjectOntoPlane(AxisVector); 279 // L og() << Verbose(1) << "SideB: " << SideB << endl;280 // LOG(1, "SideB: " << SideB); 280 281 281 282 SideC = left->second.second->getPosition() - right->second.second->getPosition(); 282 283 SideC.ProjectOntoPlane(AxisVector); 283 // L og() << Verbose(1) << "SideC: " << SideC << endl;284 // LOG(1, "SideC: " << SideC); 284 285 285 286 SideH = runner->second.second->getPosition() -(*MolCenter); 286 287 SideH.ProjectOntoPlane(AxisVector); 287 // L og() << Verbose(1) << "SideH: " << SideH << endl;288 // LOG(1, "SideH: " << SideH); 288 289 289 290 // calculate each length … … 298 299 const double delta = SideC.Angle(SideH); 299 300 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 300 //L og() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;301 DoLog(1) && (Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl);301 //LOG(1, " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "."); 302 LOG(1, "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "."); 302 303 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { 303 304 // throw out point 304 DoLog(1) && (Log() << Verbose(1) << "Throwing out " << *runner->second.second << "." << endl);305 LOG(1, "Throwing out " << *runner->second.second << "."); 305 306 BoundaryPoints[axis].erase(runner); 306 307 runner = right; … … 340 341 } else { 341 342 BoundaryPoints = BoundaryPts; 342 DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);343 LOG(0, "Using given boundary points set."); 343 344 } 344 345 345 346 // printing all inserted for debugging 346 for (int axis=0; axis < NDIM; axis++) { 347 DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl); 348 int i=0; 349 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 350 if (runner != BoundaryPoints[axis].begin()) 351 DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second); 352 else 353 DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second); 354 i++; 355 } 356 DoLog(0) && (Log() << Verbose(0) << endl); 347 if (DoLog(1)) { 348 for (int axis=0; axis < NDIM; axis++) { 349 std::stringstream output; 350 output << "Printing list of candidates for axis " << axis << " which we have inserted so far: "; 351 int i=0; 352 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 353 if (runner != BoundaryPoints[axis].begin()) 354 output << ", " << i << ": " << *runner->second.second; 355 else 356 output << i << ": " << *runner->second.second; 357 i++; 358 } 359 LOG(1, output.str()); 360 } 357 361 } 358 362 … … 361 365 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 362 366 if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0)) 363 DoLog(2) && (Log()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present." << endl);364 365 DoLog(0) && (Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl);367 LOG(2, "Point " << *(runner->second.second) << " is already present."); 368 369 LOG(0, "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary."); 366 370 // now we have the whole set of edge points in the BoundaryList 367 371 368 372 // listing for debugging 369 // Log() << Verbose(1) << "Listing PointsOnBoundary:"; 373 //if (DoLog(1)) { 374 // std::stringstream output; 375 // output << "Listing PointsOnBoundary:"; 370 376 // for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) { 371 // Log() << Verbose(0)<< " " << *runner->second;377 // output << " " << *runner->second; 372 378 // } 373 // Log() << Verbose(0) << endl; 379 // LOG(1, output.str()); 380 //} 374 381 375 382 // 3a. guess starting triangle … … 382 389 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 383 390 if (!TesselStruct->InsertStraddlingPoints(cloud, LCList)) 384 DoeLog(1) && (eLog()<< Verbose(1) << "Insertion of straddling points failed!" << endl);385 386 DoLog(0) && (Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl);391 ELOG(1, "Insertion of straddling points failed!"); 392 393 LOG(0, "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points."); 387 394 388 395 // 4. Store triangles in tecplot file … … 396 403 for (LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) { 397 404 line = LineRunner->second; 398 DoLog(1) && (Log() << Verbose(1) << "INFO: Current line is " << *line << "." << endl);405 LOG(1, "INFO: Current line is " << *line << "."); 399 406 if (!line->CheckConvexityCriterion()) { 400 DoLog(1) && (Log() << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl);407 LOG(1, "... line " << *line << " is concave, flipping it."); 401 408 402 409 // flip the line 403 410 if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.) 404 DoeLog(1) && (eLog()<< Verbose(1) << "Correction of concave baselines failed!" << endl);411 ELOG(1, "Correction of concave baselines failed!"); 405 412 else { 406 413 TesselStruct->FlipBaseline(line); 407 DoLog(1) && (Log() << Verbose(1) << "INFO: Correction of concave baselines worked." << endl);414 LOG(1, "INFO: Correction of concave baselines worked."); 408 415 LineRunner = TesselStruct->LinesOnBoundary.begin(); // LineRunner may have been erase if line was deleted from LinesOnBoundary 409 416 } … … 414 421 // 3e. we need another correction here, for TesselPoints that are below the surface (i.e. have an odd number of concave triangles surrounding it) 415 422 // if (!TesselStruct->CorrectConcaveTesselPoints(out)) 416 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;417 418 DoLog(0) && (Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl);423 // ELOG(1, "Correction of concave tesselpoints failed!"); 424 425 LOG(0, "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points."); 419 426 420 427 // 4. Store triangles in tecplot file … … 440 447 441 448 if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) { 442 DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty." << endl);449 ELOG(1, "TesselStruct is empty."); 443 450 return false; 444 451 } … … 446 453 PointMap::iterator PointRunner; 447 454 while (!TesselStruct->PointsOnBoundary.empty()) { 448 DoLog(1) && (Log() << Verbose(1) << "Remaining points are: "); 449 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 450 DoLog(0) && (Log() << Verbose(0) << *(PointSprinter->second) << "\t"); 451 DoLog(0) && (Log() << Verbose(0) << endl); 455 if (DoLog(1)) { 456 std::stringstream output; 457 output << "Remaining points are: "; 458 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 459 output << *(PointSprinter->second) << "\t"; 460 LOG(1, output.str()); 461 } 452 462 453 463 PointRunner = TesselStruct->PointsOnBoundary.begin(); … … 505 515 // check whether there is something to work on 506 516 if (TesselStruct == NULL) { 507 DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty!" << endl);517 ELOG(1, "TesselStruct is empty!"); 508 518 return volume; 509 519 } … … 521 531 PointAdvance++; 522 532 point = PointRunner->second; 523 DoLog(1) && (Log() << Verbose(1) << "INFO: Current point is " << *point << "." << endl);533 LOG(1, "INFO: Current point is " << *point << "."); 524 534 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 525 535 line = LineRunner->second; 526 DoLog(1) && (Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl);536 LOG(1, "INFO: Current line of point " << *point << " is " << *line << "."); 527 537 if (!line->CheckConvexityCriterion()) { 528 538 // remove the point if needed 529 DoLog(1) && (Log() << Verbose(1) << "... point " << *point << " cannot be on convex envelope." << endl);539 LOG(1, "... point " << *point << " cannot be on convex envelope."); 530 540 volume += TesselStruct->RemovePointFromTesselatedSurface(point); 531 541 sprintf(dummy, "-first-%d", ++run); … … 548 558 LineAdvance++; 549 559 line = LineRunner->second; 550 DoLog(1) && (Log() << Verbose(1) << "INFO: Picking farthest baseline for line is " << *line << "." << endl);560 LOG(1, "INFO: Picking farthest baseline for line is " << *line << "."); 551 561 // take highest of both lines 552 562 if (TesselStruct->IsConvexRectangle(line) == NULL) { … … 571 581 // LineAdvance++; 572 582 // line = LineRunner->second; 573 // L og() << Verbose(1) << "INFO: Current line is " << *line << "." << endl;583 // LOG(1, "INFO: Current line is " << *line << "."); 574 584 // //if (LineAdvance != TesselStruct->LinesOnBoundary.end()) 575 // //L og() << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;585 // //LOG(1, "INFO: Next line will be " << *(LineAdvance->second) << "."); 576 586 // if (!line->CheckConvexityCriterion(out)) { 577 // L og() << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;587 // LOG(1, "INFO: ... line " << *line << " is concave, flipping it."); 578 588 // 579 589 // // take highest of both lines … … 589 599 590 600 // end 591 DoLog(0) && (Log() << Verbose(0) << "Volume is " << volume << "." << endl);601 LOG(0, "Volume is " << volume << "."); 592 602 return volume; 593 603 }; … … 622 632 const double h = x.Norm(); // distance of CoG to triangle 623 633 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 624 L og() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "634 LOG(1, "INFO: Area of triangle is " << setprecision(10) << G << " " 625 635 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 626 636 << h << " and the volume is " << PyramidVolume << " " 627 << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;637 << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 628 638 volume += PyramidVolume; 629 639 } 630 Log() << Verbose(0) << "RESULT: The summed volume is " << setprecision(6) 631 << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." 632 << endl; 640 LOG(0, "RESULT: The summed volume is " << setprecision(6) 641 << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 633 642 634 643 return volume; … … 722 731 totalmass += (*iter)->getType()->getMass(); 723 732 } 724 DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);725 DoLog(0) && (Log() << Verbose(0) << "RESULT: The average density is " << setprecision(10) << totalmass / clustervolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);733 LOG(0, "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit."); 734 LOG(0, "RESULT: The average density is " << setprecision(10) << totalmass / clustervolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 726 735 727 736 // solve cubic polynomial 728 DoLog(1) && (Log() << Verbose(1) << "Solving equidistant suspension in water problem ..." << endl);737 LOG(1, "Solving equidistant suspension in water problem ..."); 729 738 if (IsAngstroem) 730 739 cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_A - (totalmass / clustervolume)) / (celldensity - 1); 731 740 else 732 741 cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_a0 - (totalmass / clustervolume)) / (celldensity - 1); 733 DoLog(1) && (Log() << Verbose(1) << "Cellvolume needed for a density of " << celldensity << " g/cm^3 is " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);742 LOG(1, "Cellvolume needed for a density of " << celldensity << " g/cm^3 is " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 734 743 735 744 double minimumvolume = TotalNoClusters * (GreatestDiameter[0] * GreatestDiameter[1] * GreatestDiameter[2]); 736 DoLog(1) && (Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);745 LOG(1, "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 737 746 if (minimumvolume > cellvolume) { 738 DoeLog(1) && (eLog()<< Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl);739 DoLog(0) && (Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl);747 ELOG(1, "the containing box already has a greater volume than the envisaged cell volume!"); 748 LOG(0, "Setting Box dimensions to minimum possible, the greatest diameters."); 740 749 for (int i = 0; i < NDIM; i++) 741 750 BoxLengths[i] = GreatestDiameter[i]; … … 749 758 double x2 = 0.; 750 759 if (gsl_poly_solve_cubic(BoxLengths[0], BoxLengths[1], BoxLengths[2], &x0, &x1, &x2) == 1) // either 1 or 3 on return 751 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting spacing is: " << x0 << " ." << endl);760 LOG(0, "RESULT: The resulting spacing is: " << x0 << " ."); 752 761 else { 753 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ." << endl);762 LOG(0, "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ."); 754 763 x0 = x2; // sorted in ascending order 755 764 } … … 762 771 763 772 // set new box dimensions 764 DoLog(0) && (Log() << Verbose(0) << "Translating to box with these boundaries." << endl);773 LOG(0, "Translating to box with these boundaries."); 765 774 mol->SetBoxDimension(&BoxLengths); 766 775 mol->CenterInBox(); … … 769 778 // update Box of atoms by boundary 770 779 mol->SetBoxDimension(&BoxLengths); 771 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);780 LOG(0, "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 772 781 }; 773 782 … … 809 818 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) 810 819 if ((*ListRunner)->getAtomCount() > 0) { 811 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);820 LOG(1, "Pre-creating linked cell lists for molecule " << *ListRunner << "."); 812 821 PointCloudAdaptor< molecule > cloud(*ListRunner, (*ListRunner)->name); 813 822 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list 814 DoLog(1) && (Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl);823 LOG(1, "Pre-creating tesselation for molecule " << *ListRunner << "."); 815 824 TesselStruct[(*ListRunner)] = NULL; 816 825 FindNonConvexBorder((*ListRunner), TesselStruct[(*ListRunner)], (const LinkedCell *&)LCList[(*ListRunner)], 5., NULL); … … 820 829 filler->CenterEdge(&Inserter); 821 830 const int FillerCount = filler->getAtomCount(); 822 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);831 LOG(2, "INFO: Filler molecule has the following bonds:"); 823 832 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 824 833 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); … … 827 836 ++BondRunner) { 828 837 if ((*BondRunner)->leftatom == *AtomRunner) 829 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl);838 LOG(2, " " << *(*BondRunner)); 830 839 } 831 840 } … … 837 846 for(int i=0;i<NDIM;i++) 838 847 N[i] = (int) ceil(1./FillerDistance[i]); 839 DoLog(1) && (Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl);848 LOG(1, "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "."); 840 849 841 850 // initialize seed of random number generator to current time … … 854 863 for (int i=0;i<NDIM;i++) 855 864 FillerTranslations[i] = RandomMolDisplacement*(random()/((rng_max-rng_min)/2.) - 1.); 856 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl);865 LOG(2, "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "."); 857 866 858 867 // go through all atoms … … 907 916 // insert into Filling 908 917 if (FillIt) { 909 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl);918 LOG(1, "INFO: Position at " << Inserter << " is outer point."); 910 919 // copy atom ... 911 920 CopyAtoms[(*iter)->getNr()] = (*iter)->clone(); 912 921 (*CopyAtoms[(*iter)->getNr()]).setPosition(Inserter); 913 922 Filling->AddAtom(CopyAtoms[(*iter)->getNr()]); 914 DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->getNr()]->getPosition()) << "." << endl);923 LOG(1, "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->getNr()]->getPosition()) << "."); 915 924 } else { 916 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);925 LOG(1, "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance."); 917 926 CopyAtoms[(*iter)->getNr()] = NULL; 918 927 continue; … … 928 937 Binder = (*BondRunner); 929 938 if ((CopyAtoms[Binder->leftatom->getNr()] != NULL) && (CopyAtoms[Binder->rightatom->getNr()] != NULL)) { 930 L og() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->getNr()] << " and " << *CopyAtoms[Binder->rightatom->getNr()]<< "." << endl;939 LOG(3, "Adding Bond between " << *CopyAtoms[Binder->leftatom->getNr()] << " and " << *CopyAtoms[Binder->rightatom->getNr()]<< "."); 931 940 Filling->AddBond(CopyAtoms[Binder->leftatom->getNr()], CopyAtoms[Binder->rightatom->getNr()], Binder->BondDegree); 932 941 } … … 997 1006 } 998 1007 if (Filling->empty()) { 999 DoLog(0) && (Log() << Verbose(0) << "Removing molecule " << Filling->getName() << ", all atoms have been removed." << std::endl);1008 LOG(0, "Removing molecule " << Filling->getName() << ", all atoms have been removed."); 1000 1009 World::getInstance().destroyMolecule(Filling); 1001 1010 Filling = NULL; … … 1034 1043 const bool result = (liste->size() == compareTo); 1035 1044 if (!result) { 1036 DoLog(0) && (Log() << Verbose(0) << "Skipping because of the following atoms:" << std::endl);1045 LOG(0, "Skipping because of the following atoms:"); 1037 1046 for (TesselPointSTLList::const_iterator iter = liste->begin(); 1038 1047 iter != liste->end(); 1039 1048 ++iter) { 1040 DoLog(0) && (Log() << Verbose(0) << **iter << std::endl);1049 LOG(0, **iter); 1041 1050 } 1042 1051 } … … 1106 1115 for (std::vector<molecule *>::iterator ListRunner = List.begin(); ListRunner != List.end(); ListRunner++) 1107 1116 if ((*ListRunner)->getAtomCount() > 0) { 1108 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);1117 LOG(1, "Pre-creating linked cell lists for molecule " << *ListRunner << "."); 1109 1118 PointCloudAdaptor< molecule > cloud(*ListRunner, (*ListRunner)->name); 1110 1119 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list … … 1116 1125 delete gravity; 1117 1126 //const int FillerCount = filler->getAtomCount(); 1118 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);1127 LOG(2, "INFO: Filler molecule has the following bonds:"); 1119 1128 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 1120 1129 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); … … 1123 1132 ++BondRunner) 1124 1133 if ((*BondRunner)->leftatom == *AtomRunner) 1125 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl);1134 LOG(2, " " << *(*BondRunner)); 1126 1135 } 1127 1136 … … 1130 1139 for(int i=0;i<NDIM;i++) 1131 1140 N[i] = (int) ceil(1./FillerDistance[i]); 1132 DoLog(1) && (Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl);1141 LOG(1, "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "."); 1133 1142 1134 1143 // initialize seed of random number generator to current time … … 1147 1156 for (int i=0;i<NDIM;i++) // have the random values [-1,1]*RandomMolDisplacement 1148 1157 FillerTranslations[i] = RandomMolDisplacement*(random()/((rng_max-rng_min)/2.) - 1.); 1149 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl);1158 LOG(2, "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "."); 1150 1159 1151 1160 // ... and rotation matrix … … 1173 1182 if (FillIt) { 1174 1183 Inserter = CurrentPosition + FillerTranslations; 1175 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is void point." << endl);1184 LOG(1, "INFO: Position at " << Inserter << " is void point."); 1176 1185 // fill! 1177 1186 Filling = filler->CopyMolecule(); … … 1195 1204 } 1196 1205 } else { 1197 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance." << endl);1206 LOG(1, "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance."); 1198 1207 continue; 1199 1208 } … … 1221 1230 } 1222 1231 1223 DoLog(0) && (Log() << Verbose(0) << MolList->ListOfMolecules.size() << " molecules have been inserted." << std::endl);1232 LOG(0, MolList->ListOfMolecules.size() << " molecules have been inserted."); 1224 1233 1225 1234 for (std::map<molecule *, LinkedCell *>::iterator ListRunner = LCList.begin(); !LCList.empty(); ListRunner = LCList.begin()) { … … 1250 1259 1251 1260 if (TesselStruct == NULL) { 1252 DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl);1261 LOG(1, "Allocating Tesselation struct ..."); 1253 1262 TesselStruct= new Tesselation; 1254 1263 } else { 1255 1264 delete(TesselStruct); 1256 DoLog(1) && (Log() << Verbose(1) << "Re-Allocating Tesselation struct ..." << endl);1265 LOG(1, "Re-Allocating Tesselation struct ..."); 1257 1266 TesselStruct = new Tesselation; 1258 1267 } … … 1267 1276 // 1. get starting triangle 1268 1277 if (!TesselStruct->FindStartingTriangle(RADIUS, LCList)) { 1269 DoeLog(0) && (eLog() << Verbose(0) << "No valid starting triangle found." << endl);1278 ELOG(0, "No valid starting triangle found."); 1270 1279 //performCriticalExit(); 1271 1280 } … … 1280 1289 (cerr << "There are " << TesselStruct->TrianglesOnBoundary.size() << " triangles and " << TesselStruct->OpenLines.size() << " open lines to scan for candidates." << endl); 1281 1290 // 2a. print OpenLines without candidates 1282 DoLog(1) && (Log() << Verbose(1) << "There are the following open lines to scan for a candidates:" << endl);1291 LOG(1, "There are the following open lines to scan for a candidates:"); 1283 1292 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 1284 1293 if (Runner->second->pointlist.empty()) 1285 DoLog(1) && (Log() << Verbose(1) << " " << *(Runner->second) << endl);1294 LOG(1, " " << *(Runner->second)); 1286 1295 1287 1296 // 2b. find best candidate for each OpenLine … … 1289 1298 1290 1299 // 2c. print OpenLines with candidates again 1291 DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl);1300 LOG(1, "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:"); 1292 1301 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 1293 DoLog(1) && (Log() << Verbose(1) << " " << *(Runner->second) << endl);1302 LOG(1, " " << *(Runner->second)); 1294 1303 1295 1304 // 2d. search for smallest ShortestAngle among all candidates … … 1299 1308 baseline = Runner->second; 1300 1309 ShortestAngle = baseline->ShortestAngle; 1301 DoLog(1) && (Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *(*baseline->pointlist.begin()) << " and angle " << baseline->ShortestAngle << endl);1310 LOG(1, "New best candidate is " << *baseline->BaseLine << " with point " << *(*baseline->pointlist.begin()) << " and angle " << baseline->ShortestAngle); 1302 1311 } 1303 1312 } … … 1324 1333 // class TesselPoint *Runner = NULL; 1325 1334 // Runner = *iter; 1326 // L og() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;1335 // LOG(1, "Checking on " << Runner->Name << " ... "); 1327 1336 // if (!->IsInnerPoint(Runner, LCList)) { 1328 // L og() << Verbose(2) << Runner->Name << " is outside of envelope, adding via degenerated triangles." << endl;1337 // LOG(2, Runner->Name << " is outside of envelope, adding via degenerated triangles."); 1329 1338 // ->AddBoundaryPointByDegeneratedTriangle(Runner, LCList); 1330 1339 // } else { 1331 // L og() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;1340 // LOG(2, Runner->Name << " is inside of or on envelope."); 1332 1341 // } 1333 1342 // } -
src/Tesselation/ellipsoid.cpp
r50e4e5 r47d041 55 55 double psi,theta,phi; // euler angles in ZX'Z'' convention 56 56 57 //L og() << Verbose(3) << "Begin of SquaredDistanceToEllipsoid" << endl;57 //LOG(3, "Begin of SquaredDistanceToEllipsoid"); 58 58 59 59 for(int i=0;i<3;i++) … … 62 62 // 1. translate coordinate system so that ellipsoid center is in origin 63 63 RefPoint = helper = x - EllipsoidCenter; 64 //L og() << Verbose(4) << "Translated given point is at " << RefPoint << "." << endl;64 //LOG(4, "Translated given point is at " << RefPoint << "."); 65 65 66 66 // 2. transform coordinate system by inverse of rotation matrix and of diagonal matrix … … 79 79 helper *= Matrix; 80 80 helper.ScaleAll(InverseLength); 81 //L og() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl;81 //LOG(4, "Transformed RefPoint is at " << helper << "."); 82 82 83 83 // 3. construct intersection point with unit sphere and ray between origin and x 84 84 helper.Normalize(); // is simply normalizes vector in distance direction 85 //L og() << Verbose(4) << "Transformed intersection is at " << helper << "." << endl;85 //LOG(4, "Transformed intersection is at " << helper << "."); 86 86 87 87 // 4. transform back the constructed intersection point … … 100 100 Matrix.set(2,2, cos(theta)); 101 101 helper *= Matrix; 102 //L og() << Verbose(4) << "Intersection is at " << helper << "." << endl;102 //LOG(4, "Intersection is at " << helper << "."); 103 103 104 104 // 5. determine distance between backtransformed point and x 105 105 distance = RefPoint.DistanceSquared(helper); 106 //L og() << Verbose(4) << "Squared distance between intersection and RefPoint is " << distance << "." << endl;106 //LOG(4, "Squared distance between intersection and RefPoint is " << distance << "."); 107 107 108 108 return distance; 109 //L og() << Verbose(3) << "End of SquaredDistanceToEllipsoid" << endl;109 //LOG(3, "End of SquaredDistanceToEllipsoid"); 110 110 }; 111 111 … … 149 149 } 150 150 151 //L og() << Verbose(0) << "Current summed distance is " << SumDistance << "." << endl;151 //LOG(0, "Current summed distance is " << SumDistance << "."); 152 152 return SumDistance; 153 153 }; … … 163 163 { 164 164 int status = GSL_SUCCESS; 165 DoLog(2) && (Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl);165 LOG(2, "Begin of FitPointSetToEllipsoid "); 166 166 if (N >= 3) { // check that enough points are given (9 d.o.f.) 167 167 struct EllipsoidMinimisation par; … … 216 216 EllipsoidAngle[i] = gsl_vector_get (s->x, i+6); 217 217 } 218 DoLog(4) && (Log() << Verbose(4) << setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << "." << endl);218 LOG(4, setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << "."); 219 219 } 220 220 … … 226 226 227 227 } else { 228 DoLog(3) && (Log() << Verbose(3) << "Not enough points provided for fit to ellipsoid." << endl);228 LOG(3, "Not enough points provided for fit to ellipsoid."); 229 229 return false; 230 230 } 231 DoLog(2) && (Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl);231 LOG(2, "End of FitPointSetToEllipsoid"); 232 232 if (status == GSL_SUCCESS) 233 233 return true; … … 252 252 int index; 253 253 TesselPoint *Candidate = NULL; 254 DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);254 LOG(2, "Begin of PickRandomPointSet"); 255 255 256 256 // allocate array … … 258 258 x = new Vector[PointsToPick]; 259 259 } else { 260 DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);260 ELOG(2, "Given pointer to vector array seems already allocated."); 261 261 } 262 262 … … 282 282 for(int i=0;i<NDIM;i++) // pick three random indices 283 283 LC->n[i] = ((int)random() % LC->N[i]); 284 DoLog(2) && (Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ...");284 LOG(2, "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << "."); 285 285 // get random cell 286 286 const TesselPointSTLList *List = LC->GetCurrentCell(); … … 288 288 continue; 289 289 } 290 DoLog(2) && (Log() << Verbose(2) << "with No. " << LC->index << "." << endl); 291 292 DoLog(2) && (Log() << Verbose(2) << "LC Intervals:"); 290 LOG(2, "INFO: Cell index is No. " << LC->index << "."); 291 292 if (DoLog(2)) { 293 std::stringstream output; 294 output << "LC Intervals:"; 295 for (int i=0;i<NDIM;i++) 296 output << " [" << Nlower[i] << "," << Nupper[i] << "] "; 297 LOG(2, output.str()); 298 } 299 293 300 for (int i=0;i<NDIM;i++) { 294 301 Nlower[i] = ((LC->n[i]-1) >= 0) ? LC->n[i]-1 : 0; 295 302 Nupper[i] = ((LC->n[i]+1) < LC->N[i]) ? LC->n[i]+1 : LC->N[i]-1; 296 DoLog(0) && (Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] "); 297 } 298 DoLog(0) && (Log() << Verbose(0) << endl); 303 } 299 304 300 305 // count whether there are sufficient atoms in this cell+neighbors … … 306 311 PointsLeft += List->size(); 307 312 } 308 DoLog(2) && (Log() << Verbose(2) << "There are " << PointsLeft << " atoms in this neighbourhood." << endl);313 LOG(2, "There are " << PointsLeft << " atoms in this neighbourhood."); 309 314 if (PointsLeft < PointsToPick) { // ensure that we can pick enough points in its neighbourhood at all. 310 315 continue; … … 317 322 current = PickedAtomNrs.find(index); // not present? 318 323 if (current == PickedAtomNrs.end()) { 319 //L og() << Verbose(2) << "Picking atom Nr. " << index << "." << endl;324 //LOG(2, "Picking atom Nr. " << index << "."); 320 325 PickedAtomNrs.insert(index); 321 326 } … … 329 334 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 330 335 const TesselPointSTLList *List = LC->GetCurrentCell(); 331 // L og() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;336 // LOG(2, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points."); 332 337 if (List != NULL) { 333 338 // if (List->begin() != List->end()) 334 // L og() << Verbose(2) << "Going through candidates ... " << endl;339 // LOG(2, "Going through candidates ... "); 335 340 // else 336 // L og() << Verbose(2) << "Cell is empty ... " << endl;341 // LOG(2, "Cell is empty ... "); 337 342 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 338 343 if ((current != PickedAtomNrs.end()) && (*current == index)) { 339 344 Candidate = (*Runner); 340 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << (*Runner)->getName() << " with index " << index << "." << endl);345 LOG(2, "Current picked node is " << (*Runner)->getName() << " with index " << index << "."); 341 346 x[PointsPicked++] = Candidate->getPosition(); // we have one more atom picked 342 347 current++; // next pre-picked atom … … 345 350 } 346 351 // } else { 347 // L og() << Verbose(2) << "List for this index not allocated!" << endl;352 // LOG(2, "List for this index not allocated!"); 348 353 } 349 354 } 350 DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);355 LOG(2, "The following points were picked: "); 351 356 for (size_t i=0;i<PointsPicked;i++) 352 DoLog(2) && (Log() << Verbose(2) << x[i] << endl);357 LOG(2, x[i]); 353 358 if (PointsPicked == PointsToPick) // break out of loop if we have all 354 359 break; 355 360 } while(1); 356 361 357 DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl);362 LOG(2, "End of PickRandomPointSet"); 358 363 }; 359 364 … … 370 375 double value, threshold; 371 376 PointMap *List = &T->PointsOnBoundary; 372 DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);377 LOG(2, "Begin of PickRandomPointSet"); 373 378 374 379 // allocate array … … 376 381 x = new Vector[PointsToPick]; 377 382 } else { 378 DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);383 ELOG(2, "Given pointer to vector array seems already allocated."); 379 384 } 380 385 … … 386 391 threshold = 1. - (double)(PointsToPick - PointsPicked)/(double)PointsLeft; 387 392 value = (double)random()/(double)(rng_max-rng_min); 388 //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": ";389 393 if (value > threshold) { 390 394 x[PointsPicked] = (Runner->second->node->getPosition()); 391 395 PointsPicked++; 392 //L og() << Verbose(0) << "IN." << endl;396 //LOG(3, "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": IN."); 393 397 } else { 394 //L og() << Verbose(0) << "OUT." << endl;398 //LOG(3, "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": OUT."); 395 399 } 396 400 PointsLeft--; 397 401 } 398 DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);402 LOG(2, "The following points were picked: "); 399 403 for (size_t i=0;i<PointsPicked;i++) 400 DoLog(3) && (Log() << Verbose(3) << x[i] << endl);401 402 DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl);404 LOG(3, x[i]); 405 406 LOG(2, "End of PickRandomPointSet"); 403 407 }; 404 408 … … 420 424 double EllipsoidAngle[3]; 421 425 double distance, MaxDistance, MinDistance; 422 DoLog(0) && (Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl);426 LOG(0, "Begin of FindDistributionOfEllipsoids"); 423 427 424 428 // construct center of gravity of boundary point set for initial ellipsoid center … … 427 431 Center += (Runner->second->node->getPosition()); 428 432 Center.Scale(1./T->PointsOnBoundaryCount); 429 DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl);433 LOG(1, "Center is at " << Center << "."); 430 434 431 435 // Output header … … 435 439 // loop over desired number of parameter sets 436 440 for (;number >0;number--) { 437 DoLog(1) && (Log() << Verbose(1) << "Determining data set " << number << " ... " << endl);441 LOG(1, "Determining data set " << number << " ... "); 438 442 // pick the point set 439 443 x = NULL; … … 451 455 MinDistance = distance; 452 456 } 453 //L og() << Verbose(2) << "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << "." << endl;457 //LOG(2, "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << "."); 454 458 EllipsoidCenter = Center; // use Center of Gravity as initial center of ellipsoid 455 459 for (int i=0;i<3;i++) … … 461 465 // fit the parameters 462 466 if (FitPointSetToEllipsoid(x, N, &EllipsoidCenter, &EllipsoidLength[0], &EllipsoidAngle[0])) { 463 DoLog(1) && (Log() << Verbose(1) << "Picking succeeded!" << endl);467 LOG(1, "Picking succeeded!"); 464 468 // output obtained parameter set 465 469 output << number << "\t"; … … 472 476 output << endl; 473 477 } else { // increase N to pick one more 474 DoLog(1) && (Log() << Verbose(1) << "Picking failed!" << endl);478 LOG(1, "Picking failed!"); 475 479 number++; 476 480 } … … 480 484 output.close(); 481 485 482 DoLog(0) && (Log() << Verbose(0) << "End of FindDistributionOfEllipsoids" << endl);483 }; 486 LOG(0, "End of FindDistributionOfEllipsoids"); 487 }; -
src/Tesselation/tesselation.cpp
r50e4e5 r47d041 22 22 #include <fstream> 23 23 #include <iomanip> 24 #include <sstream> 24 25 25 26 #include "BoundaryPointSet.hpp" … … 76 77 { 77 78 Info FunctionInfo(__func__); 78 DoLog(0) && (Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl);79 LOG(0, "Free'ing TesselStruct ... "); 79 80 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 80 81 if (runner->second != NULL) { … … 82 83 runner->second = NULL; 83 84 } else 84 DoeLog(1) && (eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl);85 } 86 DoLog(0) && (Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl);85 ELOG(1, "The triangle " << runner->first << " has already been free'd."); 86 } 87 LOG(0, "This envelope was written to file " << TriangleFilesWritten << " times(s)."); 87 88 } 88 89 … … 121 122 } 122 123 } 123 // // listing distances 124 // Log() << Verbose(1) << "Listing DistanceMMap:"; 125 // for(DistanceMultiMap::iterator runner = DistanceMMap.begin(); runner != DistanceMMap.end(); runner++) { 126 // Log() << Verbose(0) << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")"; 127 // } 128 // Log() << Verbose(0) << endl; 124 // // listing distances 125 // if (DoLog(1)) { 126 // std::stringstream output; 127 // output << "Listing DistanceMMap:"; 128 // for(DistanceMultiMap::iterator runner = DistanceMMap.begin(); runner != DistanceMMap.end(); runner++) { 129 // output << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")"; 130 // } 131 // LOG(1, output.str()); 132 // } 129 133 // 4b2. pick three baselines forming a triangle 130 134 // 1. we take from the smallest sum of squared distance as the base line BC (with peak A) onward as the triangle candidate … … 137 141 baseline->second.first->second->node->getPosition(), 138 142 baseline->second.second->second->node->getPosition()).getNormal(); 139 DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);143 LOG(2, "Plane vector of candidate triangle is " << PlaneVector); 140 144 // 4. loop over all points 141 145 double sign = 0.; … … 150 154 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 151 155 continue; 152 DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->getName() << " yields distance of " << distance << "." << endl);156 LOG(2, "Projection of " << checker->second->node->getName() << " yields distance of " << distance << "."); 153 157 tmp = distance / fabs(distance); 154 158 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) 155 159 if ((sign != 0) && (tmp != sign)) { 156 160 // 4c. If so, break 4. loop and continue with next candidate in 1. loop 157 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leaves " << checker->second->node->getName() << " outside the convex hull." << endl);161 LOG(2, "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leaves " << checker->second->node->getName() << " outside the convex hull."); 158 162 break; 159 163 } else { // note the sign for later 160 DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leave " << checker->second->node->getName() << " inside the convex hull." << endl);164 LOG(2, "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leave " << checker->second->node->getName() << " inside the convex hull."); 161 165 sign = tmp; 162 166 } … … 178 182 // 5. come this far, all on same side? Then break 1. loop and construct triangle 179 183 if (checker == PointsOnBoundary.end()) { 180 DoLog(2) && (Log() << Verbose(2) << "Looks like we have a candidate!" << endl);184 LOG(2, "Looks like we have a candidate!"); 181 185 break; 182 186 } … … 202 206 } 203 207 204 DoLog(1) && (Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl);208 LOG(1, "Starting triangle is " << *BTS << "."); 205 209 } else { 206 DoeLog(0) && (eLog() << Verbose(0) << "No starting triangle found." << endl);210 ELOG(0, "No starting triangle found."); 207 211 } 208 212 } … … 243 247 // get peak point with respect to this base line's only triangle 244 248 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 245 DoLog(0) && (Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl);249 LOG(0, "Current baseline is between " << *(baseline->second) << "."); 246 250 for (int i = 0; i < 3; i++) 247 251 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 248 252 peak = BTS->endpoints[i]; 249 DoLog(1) && (Log() << Verbose(1) << " and has peak " << *peak << "." << endl);253 LOG(1, " and has peak " << *peak << "."); 250 254 251 255 // prepare some auxiliary vectors … … 260 264 CenterVector += BTS->getEndpoint(i); 261 265 CenterVector.Scale(1. / 3.); 262 DoLog(2) && (Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl);266 LOG(2, "CenterVector of base triangle is " << CenterVector); 263 267 264 268 // normal vector of triangle … … 266 270 BTS->GetNormalVector(NormalVector); 267 271 NormalVector = BTS->NormalVector; 268 DoLog(2) && (Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl);272 LOG(2, "NormalVector of base triangle is " << NormalVector); 269 273 270 274 // vector in propagation direction (out of triangle) … … 272 276 PropagationVector = Plane(BaseLine, NormalVector,0).getNormal(); 273 277 TempVector = CenterVector - (baseline->second->endpoints[0]->node->getPosition()); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 274 //L og() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;278 //LOG(0, "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "."); 275 279 if (PropagationVector.ScalarProduct(TempVector) > 0) // make sure normal propagation vector points outward from baseline 276 280 PropagationVector.Scale(-1.); 277 DoLog(2) && (Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl);281 LOG(2, "PropagationVector of base triangle is " << PropagationVector); 278 282 winner = PointsOnBoundary.end(); 279 283 … … 281 285 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 282 286 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 283 DoLog(1) && (Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl);287 LOG(1, "Target point is " << *(target->second) << ":"); 284 288 285 289 // first check direction, so that triangles don't intersect … … 287 291 VirtualNormalVector.ProjectOntoPlane(NormalVector); 288 292 TempAngle = VirtualNormalVector.Angle(PropagationVector); 289 DoLog(2) && (Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl);293 LOG(2, "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "."); 290 294 if (TempAngle > (M_PI / 2.)) { // no bends bigger than Pi/2 (90 degrees) 291 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl);295 LOG(2, "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!"); 292 296 continue; 293 297 } else 294 DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl);298 LOG(2, "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!"); 295 299 296 300 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 298 302 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 299 303 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 300 DoLog(2) && (Log() << Verbose(2) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl);304 LOG(2, *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles."); 301 305 continue; 302 306 } 303 307 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 304 DoLog(2) && (Log() << Verbose(2) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl);308 LOG(2, *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles."); 305 309 continue; 306 310 } … … 308 312 // check whether the envisaged triangle does not already exist (if both lines exist and have same endpoint) 309 313 if ((((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (GetCommonEndpoint(LineChecker[0]->second, LineChecker[1]->second) == peak)))) { 310 DoLog(4) && (Log() << Verbose(4) << "Current target is peak!" << endl);314 LOG(4, "Current target is peak!"); 311 315 continue; 312 316 } … … 317 321 helper.ProjectOntoPlane(TempVector); 318 322 if (fabs(helper.NormSquared()) < MYEPSILON) { 319 DoLog(2) && (Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl);323 LOG(2, "Chosen set of vectors is linear dependent."); 320 324 continue; 321 325 } … … 335 339 // calculate angle 336 340 TempAngle = NormalVector.Angle(VirtualNormalVector); 337 DoLog(2) && (Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl);341 LOG(2, "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "."); 338 342 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 339 343 SmallestAngle = TempAngle; 340 344 winner = target; 341 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);345 LOG(2, "New winner " << *winner->second->node << " due to smaller angle between normal vectors."); 342 346 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 343 347 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 354 358 SmallestAngle = TempAngle; 355 359 winner = target; 356 DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl);360 LOG(2, "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction."); 357 361 } else 358 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl);362 LOG(2, "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction."); 359 363 } else 360 DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);364 LOG(2, "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors."); 361 365 } 362 366 } // end of loop over all boundary points … … 364 368 // 5b. The point of the above whose triangle has the greatest angle with the triangle the current line belongs to (it only belongs to one, remember!): New triangle 365 369 if (winner != PointsOnBoundary.end()) { 366 DoLog(0) && (Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl);370 LOG(0, "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "."); 367 371 // create the lins of not yet present 368 372 BLS[0] = baseline->second; … … 394 398 TrianglesOnBoundaryCount++; 395 399 } else { 396 DoeLog(2) && (eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl);400 ELOG(2, "I could not determine a winner for this baseline " << *(baseline->second) << "."); 397 401 } 398 402 399 403 // 5d. If the set of lines is not yet empty, go to 5. and continue 400 404 } else 401 DoLog(0) && (Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl);405 LOG(0, "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "."); 402 406 } while (flag); 403 407 … … 434 438 } 435 439 Walker = cloud.GetPoint(); 436 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);440 LOG(0, "Current point is " << *Walker << "."); 437 441 // get the next triangle 438 442 triangles = FindClosestTrianglesToVector(Walker->getPosition(), BoundaryPoints); … … 443 447 delete triangles; 444 448 if ((BTS == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 445 DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl);449 LOG(0, "No triangles found, probably a tesselation point itself."); 446 450 cloud.GoToNext(); 447 451 continue; 448 452 } else { 449 453 } 450 DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);454 LOG(0, "Closest triangle is " << *BTS << "."); 451 455 // get the intersection point 452 456 if (BTS->GetIntersectionInsideTriangle(*Center, Walker->getPosition(), Intersection)) { 453 DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);457 LOG(0, "We have an intersection at " << Intersection << "."); 454 458 // we have the intersection, check whether in- or outside of boundary 455 459 if ((Center->DistanceSquared(Walker->getPosition()) - Center->DistanceSquared(Intersection)) < -MYEPSILON) { 456 460 // inside, next! 457 DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);461 LOG(0, *Walker << " is inside wrt triangle " << *BTS << "."); 458 462 } else { 459 463 // outside! 460 DoLog(0) && (Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl);464 LOG(0, *Walker << " is outside wrt triangle " << *BTS << "."); 461 465 class BoundaryLineSet *OldLines[3], *NewLines[3]; 462 466 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 468 472 Normal = BTS->NormalVector; 469 473 // add Walker to boundary points 470 DoLog(0) && (Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl);474 LOG(0, "Adding " << *Walker << " to BoundaryPoints."); 471 475 AddFlag = true; 472 476 if (AddBoundaryPoint(Walker, 0)) … … 475 479 continue; 476 480 // remove triangle 477 DoLog(0) && (Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl);481 LOG(0, "Erasing triangle " << *BTS << "."); 478 482 TrianglesOnBoundary.erase(BTS->Nr); 479 483 delete (BTS); … … 483 487 BPS[1] = OldPoints[i]; 484 488 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 485 DoLog(1) && (Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl);489 LOG(1, "Creating new line " << *NewLines[i] << "."); 486 490 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 487 491 LinesOnBoundaryCount++; … … 494 498 if (NewLines[j]->IsConnectedTo(BLS[0])) { 495 499 if (n > 2) { 496 DoeLog(2) && (eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl);500 ELOG(2, BLS[0] << " connects to all of the new lines?!"); 497 501 return false; 498 502 } else … … 505 509 BTS->GetNormalVector(Normal); 506 510 Normal.Scale(-1.); 507 DoLog(0) && (Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl);511 LOG(0, "Created new triangle " << *BTS << "."); 508 512 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 509 513 TrianglesOnBoundaryCount++; … … 511 515 } 512 516 } else { // something is wrong with FindClosestTriangleToPoint! 513 DoeLog(1) && (eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl);517 ELOG(1, "The closest triangle did not produce an intersection!"); 514 518 SuccessFlag = false; 515 519 break; … … 562 566 } else { 563 567 delete TPS[n]; 564 DoLog(0) && (Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl);568 LOG(0, "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary."); 565 569 TPS[n] = (InsertUnique.first)->second; 566 570 } … … 599 603 BoundaryLineSet *WinningLine = NULL; 600 604 if (FindLine != a->lines.end()) { 601 DoLog(1) && (Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl);605 LOG(1, "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "."); 602 606 603 607 pair<LineMap::iterator, LineMap::iterator> FindPair; … … 605 609 606 610 for (FindLine = FindPair.first; (FindLine != FindPair.second) && (insertNewLine); FindLine++) { 607 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);611 LOG(1, "INFO: Checking line " << *(FindLine->second) << " ..."); 608 612 // If there is a line with less than two attached triangles, we don't need a new line. 609 613 if (FindLine->second->triangles.size() == 1) { 610 614 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 611 615 if (!Finder->second->pointlist.empty()) 612 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);616 LOG(1, "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "."); 613 617 else 614 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl);618 LOG(1, "INFO: line " << *(FindLine->second) << " is open with no candidate."); 615 619 // get open line 616 620 for (TesselPointList::const_iterator CandidateChecker = Finder->second->pointlist.begin(); CandidateChecker != Finder->second->pointlist.end(); ++CandidateChecker) { 617 621 if ((*(CandidateChecker) == candidate->node) && (OptCenter == NULL || OptCenter->DistanceSquared(Finder->second->OptCenter) < MYEPSILON )) { // stop searching if candidate matches 618 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Candidate " << *(*CandidateChecker) << " has the right center " << Finder->second->OptCenter << "." << endl);622 LOG(1, "ACCEPT: Candidate " << *(*CandidateChecker) << " has the right center " << Finder->second->OptCenter << "."); 619 623 insertNewLine = false; 620 624 WinningLine = FindLine->second; 621 625 break; 622 626 } else { 623 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *(*CandidateChecker) << "'s center " << Finder->second->OptCenter << " does not match desired on " << *OptCenter << "." << endl);627 LOG(1, "REJECT: Candidate " << *(*CandidateChecker) << "'s center " << Finder->second->OptCenter << " does not match desired on " << *OptCenter << "."); 624 628 } 625 629 } … … 647 651 { 648 652 Info FunctionInfo(__func__); 649 DoLog(0) && (Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl);653 LOG(0, "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "."); 650 654 BPS[0] = a; 651 655 BPS[1] = b; … … 669 673 { 670 674 Info FunctionInfo(__func__); 671 DoLog(0) && (Log() << Verbose(0) << "Using existing line " << *Line << endl);675 LOG(0, "Using existing line " << *Line); 672 676 673 677 // set endpoints and line … … 678 682 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 679 683 if (CandidateLine != OpenLines.end()) { 680 DoLog(1) && (Log() << Verbose(1) << " Removing line from OpenLines." << endl);684 LOG(1, " Removing line from OpenLines."); 681 685 delete (CandidateLine->second); 682 686 OpenLines.erase(CandidateLine); 683 687 } else { 684 DoeLog(1) && (eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl);688 ELOG(1, "Line exists and is attached to less than two triangles, but not in OpenLines!"); 685 689 } 686 690 } … … 693 697 { 694 698 Info FunctionInfo(__func__); 695 DoLog(1) && (Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl);699 LOG(1, "Adding triangle to global TrianglesOnBoundary map."); 696 700 697 701 // add triangle to global map … … 713 717 { 714 718 Info FunctionInfo(__func__); 715 DoLog(0) && (Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl);719 LOG(0, "Adding triangle to global TrianglesOnBoundary map."); 716 720 717 721 // add triangle to global map … … 737 741 for (int i = 0; i < 3; i++) { 738 742 if (triangle->lines[i] != NULL) { 739 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl);743 LOG(0, "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "."); 740 744 triangle->lines[i]->triangles.erase(triangle->Nr); 745 std::stringstream output; 746 output << "INFO: " << *triangle->lines[i] << " is "; 741 747 if (triangle->lines[i]->triangles.empty()) { 742 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl);748 output << "no more attached to any triangle, erasing."; 743 749 RemoveTesselationLine(triangle->lines[i]); 744 750 } else { 745 DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: " << endl);751 output << "still attached to another triangle: "; 746 752 OpenLines.insert(pair<BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL)); 747 753 for (TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 748 DoLog(0) && (Log() << Verbose(0) << "\t[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"); 749 DoLog(0) && (Log() << Verbose(0) << endl); 750 // for (int j=0;j<2;j++) { 751 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 752 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 753 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; 754 // Log() << Verbose(0) << endl; 755 // } 754 output << "\t[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 756 755 } 756 LOG(1, output.str()); 757 757 triangle->lines[i] = NULL; // free'd or not: disconnect 758 758 } else 759 DoeLog(1) && (eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl);759 ELOG(1, "This line " << i << " has already been free'd."); 760 760 } 761 761 762 762 if (TrianglesOnBoundary.erase(triangle->Nr)) 763 DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl);763 LOG(0, "Removing triangle Nr. " << triangle->Nr << "."); 764 764 delete (triangle); 765 765 } … … 793 793 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 794 794 if ((*Runner).second == line) { 795 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);795 LOG(0, "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "."); 796 796 line->endpoints[i]->lines.erase(Runner); 797 797 break; … … 799 799 } else { // there's just a single line left 800 800 if (line->endpoints[i]->lines.erase(line->Nr)) 801 DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);801 LOG(0, "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "."); 802 802 } 803 803 if (line->endpoints[i]->lines.empty()) { 804 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl);804 LOG(0, *line->endpoints[i] << " has no more lines it's attached to, erasing."); 805 805 RemoveTesselationPoint(line->endpoints[i]); 806 } else { 807 DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "); 806 } else if (DoLog(0)) { 807 std::stringstream output; 808 output << *line->endpoints[i] << " has still lines it's attached to: "; 808 809 for (LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 809 DoLog(0) && (Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t");810 DoLog(0) && (Log() << Verbose(0) << endl);810 output << "[" << *(LineRunner->second) << "] \t"; 811 LOG(0, output.str()); 811 812 } 812 813 line->endpoints[i] = NULL; // free'd or not: disconnect 813 814 } else 814 DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl);815 ELOG(1, "Endpoint " << i << " has already been free'd."); 815 816 } 816 817 if (!line->triangles.empty()) 817 DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl);818 ELOG(2, "Memory Leak! I " << *line << " am still connected to some triangles."); 818 819 819 820 if (LinesOnBoundary.erase(line->Nr)) 820 DoLog(0) && (Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl);821 LOG(0, "Removing line Nr. " << line->Nr << "."); 821 822 delete (line); 822 823 } … … 834 835 return; 835 836 if (PointsOnBoundary.erase(point->Nr)) 836 DoLog(0) && (Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl);837 LOG(0, "Removing point Nr. " << point->Nr << "."); 837 838 delete (point); 838 839 } … … 851 852 Info FunctionInfo(__func__); 852 853 853 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);854 LOG(1, "INFO: Checking whether sphere contains no others points ..."); 854 855 bool flag = true; 855 856 856 DoLog(1) && (Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter[0] << " " << CandidateLine.OtherOptCenter[1] << " " << CandidateLine.OtherOptCenter[2] << "} radius " << RADIUS << " resolution 30" << endl);857 LOG(1, "Check by: draw sphere {" << CandidateLine.OtherOptCenter[0] << " " << CandidateLine.OtherOptCenter[1] << " " << CandidateLine.OtherOptCenter[2] << "} radius " << RADIUS << " resolution 30"); 857 858 // get all points inside the sphere 858 859 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, &CandidateLine.OtherOptCenter); 859 860 860 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);861 LOG(1, "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":"); 861 862 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 862 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);863 LOG(1, " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "."); 863 864 864 865 // remove triangles's endpoints … … 872 873 // check for other points 873 874 if (!ListofPoints->empty()) { 874 DoLog(1) && (Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl);875 LOG(1, "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere."); 875 876 flag = false; 876 DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);877 LOG(1, "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":"); 877 878 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 878 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);879 LOG(1, " " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "."); 879 880 } 880 881 delete (ListofPoints); … … 917 918 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->getNr()); FindLine++) { 918 919 TriangleMap *triangles = &FindLine->second->triangles; 919 DoLog(1) && (Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl);920 LOG(1, "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "."); 920 921 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 921 922 if (FindTriangle->second->IsPresentTupel(Points)) { … … 923 924 } 924 925 } 925 DoLog(1) && (Log() << Verbose(1) << "end." << endl);926 LOG(1, "end."); 926 927 } 927 928 // Only one of the triangle lines must be considered for the triangle count. 928 //L og() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;929 //LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 929 930 //return adjacentTriangleCount; 930 931 } … … 933 934 } 934 935 935 DoLog(0) && (Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl);936 LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 936 937 return adjacentTriangleCount; 937 938 } … … 978 979 } 979 980 // Only one of the triangle lines must be considered for the triangle count. 980 //L og() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;981 //LOG(0, "Found " << adjacentTriangleCount << " adjacent triangles for the point set."); 981 982 //return adjacentTriangleCount; 982 983 } … … 1028 1029 for (LC->n[map[2]] = 0; LC->n[map[2]] < LC->N[map[2]]; LC->n[map[2]]++) { 1029 1030 const TesselPointSTLList *List = LC->GetCurrentCell(); 1030 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1031 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 1031 1032 if (List != NULL) { 1032 1033 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 1033 1034 if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) { 1034 DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl);1035 LOG(1, "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "."); 1035 1036 maxCoordinate[map[0]] = (*Runner)->at(map[0]); 1036 1037 MaxPoint[map[0]] = (*Runner); … … 1038 1039 } 1039 1040 } else { 1040 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);1041 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 1041 1042 } 1042 1043 } 1043 1044 } 1044 1045 1045 DoLog(1) && (Log() << Verbose(1) << "Found maximum coordinates: "); 1046 for (int i = 0; i < NDIM; i++) 1047 DoLog(0) && (Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"); 1048 DoLog(0) && (Log() << Verbose(0) << endl); 1046 if (DoLog(1)) { 1047 std::stringstream output; 1048 output << "Found maximum coordinates: "; 1049 for (int i = 0; i < NDIM; i++) 1050 output << i << ": " << *MaxPoint[i] << "\t"; 1051 LOG(1, output.str()); 1052 } 1049 1053 1050 1054 BTS = NULL; … … 1054 1058 BaseLine = new BoundaryLineSet(); 1055 1059 BaseLine->endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 1056 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);1060 LOG(0, "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "."); 1057 1061 1058 1062 double ShortestAngle; … … 1088 1092 1089 1093 // adding point 1 and point 2 and add the line between them 1090 DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);1091 DoLog(0) && (Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n");1092 1093 //L og() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";1094 LOG(0, "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "."); 1095 LOG(0, "Found second point is at " << *BaseLine->endpoints[1]->node << "."); 1096 1097 //LOG(1, "INFO: OldSphereCenter is at " << helper << "."); 1094 1098 CandidateForTesselation OptCandidates(BaseLine); 1095 1099 FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC); 1096 DoLog(0) && (Log() << Verbose(0) << "List of third Points is:" << endl);1100 LOG(0, "List of third Points is:"); 1097 1101 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 1098 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);1102 LOG(0, " " << *(*it)); 1099 1103 } 1100 1104 if (!OptCandidates.pointlist.empty()) { … … 1150 1154 // if (FindLine != (FindPoint->second)->lines.end()) { 1151 1155 // Line = FindLine->second; 1152 // L og() << Verbose(0) << "Found line " << *Line << "." << endl;1156 // LOG(0, "Found line " << *Line << "."); 1153 1157 // if (Line->triangles.size() == 1) { 1154 1158 // T = Line->triangles.begin()->second; … … 1167 1171 // CircleRadius = RADIUS*RADIUS - radius/4.; 1168 1172 // CirclePlaneNormal.Normalize(); 1169 // //L og() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;1173 // //LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 1170 1174 // 1171 1175 // // construct old center … … 1176 1180 // OldSphereCenter.AddVector(&helper); 1177 1181 // OldSphereCenter.SubtractVector(&CircleCenter); 1178 // //L og() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;1182 // //LOG(1, "INFO: OldSphereCenter is at " << OldSphereCenter << "."); 1179 1183 // 1180 1184 // // construct SearchDirection … … 1186 1190 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1187 1191 // SearchDirection.Normalize(); 1188 // L og() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;1192 // LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 1189 1193 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1190 1194 // // rotated the wrong way! 1191 // DoeLog(1) && (eLog()<< Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);1195 // ELOG(1, "SearchDirection and RelativeOldSphereCenter are still not orthogonal!"); 1192 1196 // } 1193 1197 // … … 1197 1201 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1198 1202 // continue; 1199 // L og() << Verbose(0) << "Third point candidate is " << (*it)1200 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;1201 // L og() << Verbose(0) << " Baseline is " << *BaseRay << endl;1203 // LOG(1, "INFO: Third point candidate is " << (*it) 1204 // << " with circumsphere's center at " << (*it)->OptCenter << "."); 1205 // LOG(1, "INFO: Baseline is " << *BaseRay); 1202 1206 // 1203 1207 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) … … 1233 1237 // if (check) { 1234 1238 // if (ShortestAngle > OtherShortestAngle) { 1235 // L og() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;1239 // LOG(0, "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "."); 1236 1240 // result = true; 1237 1241 // break; … … 1243 1247 // break; 1244 1248 // } else { 1245 // L og() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;1249 // LOG(0, "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!"); 1246 1250 // } 1247 1251 // } else { 1248 // DoeLog(2) && (eLog()<< Verbose(2) << "Baseline is connected to two triangles already?" << endl);1252 // ELOG(2, "Baseline is connected to two triangles already?"); 1249 1253 // } 1250 1254 // } else { 1251 // L og() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;1255 // LOG(1, "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "."); 1252 1256 // } 1253 1257 // } 1254 1258 // } else { 1255 // DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl);1259 // ELOG(1, "Could not find the TesselPoint " << *ThirdNode << "."); 1256 1260 // } 1257 1261 // … … 1284 1288 break; 1285 1289 } 1286 DoLog(0) && (Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl);1290 LOG(0, "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "."); 1287 1291 1288 1292 CandidateLine.T = &T; … … 1304 1308 CircleRadius = RADIUS * RADIUS - radius / 4.; 1305 1309 CirclePlaneNormal.Normalize(); 1306 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);1307 1308 DoLog(1) && (Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl);1310 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 1311 1312 LOG(1, "INFO: OldSphereCenter is at " << T.SphereCenter << "."); 1309 1313 1310 1314 // construct SearchDirection and an "outward pointer" … … 1313 1317 if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1314 1318 SearchDirection.Scale(-1.); 1315 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);1319 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 1316 1320 if (fabs(RelativeSphereCenter.ScalarProduct(SearchDirection)) > HULLEPSILON) { 1317 1321 // rotated the wrong way! 1318 DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);1322 ELOG(1, "SearchDirection and RelativeOldSphereCenter are still not orthogonal!"); 1319 1323 } 1320 1324 … … 1323 1327 1324 1328 } else { 1325 DoLog(0) && (Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl);1329 LOG(0, "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!"); 1326 1330 } 1327 1331 1328 1332 if (CandidateLine.pointlist.empty()) { 1329 DoeLog(2) && (eLog() << Verbose(2) << "Could not find a suitable candidate." << endl);1333 ELOG(2, "Could not find a suitable candidate."); 1330 1334 return false; 1331 1335 } 1332 DoLog(0) && (Log() << Verbose(0) << "Third Points are: " << endl);1336 LOG(0, "Third Points are: "); 1333 1337 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 1334 DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);1338 LOG(0, " " << *(*it)); 1335 1339 } 1336 1340 … … 1356 1360 ASSERT((baseline->BaseLine->triangles.size() == 1),"Open line without exactly one attached triangle"); 1357 1361 T = (((baseline->BaseLine->triangles.begin()))->second); 1358 DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);1362 LOG(1, "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T); 1359 1363 TesselationFailFlag = TesselationFailFlag && FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1360 1364 } … … 1387 1391 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->getPosition()); 1388 1392 1389 DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);1393 LOG(0, "List of Candidates for Turning Point " << *TurningPoint << ":"); 1390 1394 for (TesselPointList::iterator TesselRunner = connectedClosestPoints->begin(); TesselRunner != connectedClosestPoints->end(); ++TesselRunner) 1391 DoLog(0) && (Log() << Verbose(0) << " " << **TesselRunner << endl);1395 LOG(0, " " << **TesselRunner); 1392 1396 1393 1397 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) … … 1396 1400 Sprinter++; 1397 1401 while (Sprinter != connectedClosestPoints->end()) { 1398 DoLog(0) && (Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl);1402 LOG(0, "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "."); 1399 1403 1400 1404 AddTesselationPoint(TurningPoint, 0); … … 1409 1413 // fill the internal open lines with its respective candidate (otherwise lines in degenerate case are not picked) 1410 1414 FindDegeneratedCandidatesforOpenLines(*Sprinter, &CandidateLine.OptCenter); // Assume BTS contains last triangle 1411 DoLog(0) && (Log() << Verbose(0) << " There are still more triangles to add." << endl);1415 LOG(0, " There are still more triangles to add."); 1412 1416 } 1413 1417 // pick candidates for other open lines as well … … 1417 1421 if (CheckDegeneracy(CandidateLine, RADIUS, LC)) { 1418 1422 // add normal and degenerate triangles 1419 DoLog(1) && (Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl);1423 LOG(1, "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides."); 1420 1424 AddCandidateTriangle(CandidateLine, OtherOpt); 1421 1425 … … 1441 1445 pair<LineMap::iterator, LineMap::iterator> FindPair = TPS[0]->lines.equal_range(TPS[2]->node->getNr()); 1442 1446 for (LineMap::const_iterator FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { 1443 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);1447 LOG(1, "INFO: Checking line " << *(FindLine->second) << " ..."); 1444 1448 // If there is a line with less than two attached triangles, we don't need a new line. 1445 1449 if (FindLine->second->triangles.size() == 1) { 1446 1450 CandidateMap::iterator Finder = OpenLines.find(FindLine->second); 1447 1451 if (!Finder->second->pointlist.empty()) 1448 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);1452 LOG(1, "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "."); 1449 1453 else { 1450 DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl);1454 LOG(1, "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter)); 1451 1455 Finder->second->T = BTS; // is last triangle 1452 1456 Finder->second->pointlist.push_back(Sprinter); … … 1473 1477 1474 1478 /// 1. Create or pick the lines for the first triangle 1475 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl);1479 LOG(0, "INFO: Creating/Picking lines for first triangle ..."); 1476 1480 for (int i = 0; i < 3; i++) { 1477 1481 BLS[i] = NULL; 1478 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1482 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1479 1483 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 1480 1484 } 1481 1485 1482 1486 /// 2. create the first triangle and NormalVector and so on 1483 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl);1487 LOG(0, "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..."); 1484 1488 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1485 1489 AddTesselationTriangle(); … … 1492 1496 // give some verbose output about the whole procedure 1493 1497 if (CandidateLine.T != NULL) 1494 DoLog(0) && (Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1498 LOG(0, "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1495 1499 else 1496 DoLog(0) && (Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1500 LOG(0, "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1497 1501 triangle = BTS; 1498 1502 1499 1503 /// 3. Gather candidates for each new line 1500 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl);1504 LOG(0, "INFO: Adding candidates to new lines ..."); 1501 1505 for (int i = 0; i < 3; i++) { 1502 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1506 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1503 1507 CandidateCheck = OpenLines.find(BLS[i]); 1504 1508 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 1510 1514 1511 1515 /// 4. Create or pick the lines for the second triangle 1512 DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl);1516 LOG(0, "INFO: Creating/Picking lines for second triangle ..."); 1513 1517 for (int i = 0; i < 3; i++) { 1514 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1518 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1515 1519 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i); 1516 1520 } 1517 1521 1518 1522 /// 5. create the second triangle and NormalVector and so on 1519 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl);1523 LOG(0, "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..."); 1520 1524 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1521 1525 AddTesselationTriangle(); … … 1527 1531 // give some verbose output about the whole procedure 1528 1532 if (CandidateLine.T != NULL) 1529 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1533 LOG(0, "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1530 1534 else 1531 DoLog(0) && (Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1535 LOG(0, "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1532 1536 1533 1537 /// 6. Adding triangle to new lines 1534 DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl);1538 LOG(0, "INFO: Adding second triangles to new lines ..."); 1535 1539 for (int i = 0; i < 3; i++) { 1536 DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);1540 LOG(0, "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":"); 1537 1541 CandidateCheck = OpenLines.find(BLS[i]); 1538 1542 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { … … 1572 1576 // give some verbose output about the whole procedure 1573 1577 if (CandidateLine.T != NULL) 1574 DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);1578 LOG(0, "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "."); 1575 1579 else 1576 DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);1580 LOG(0, "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle."); 1577 1581 } 1578 1582 ; … … 1599 1603 OtherBase = new class BoundaryLineSet(BPS, -1); 1600 1604 1601 DoLog(1) && (Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl);1602 DoLog(1) && (Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl);1605 LOG(1, "INFO: Current base line is " << *Base << "."); 1606 LOG(1, "INFO: Other base line is " << *OtherBase << "."); 1603 1607 1604 1608 // get the closest point on each line to the other line … … 1618 1622 delete (ClosestPoint); 1619 1623 if ((distance[0] * distance[1]) > 0) { // have same sign? 1620 DoLog(1) && (Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl);1624 LOG(1, "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave."); 1621 1625 if (distance[0] < distance[1]) { 1622 1626 Spot = Base->endpoints[0]; … … 1626 1630 return Spot; 1627 1631 } else { // different sign, i.e. we are in between 1628 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl);1632 LOG(0, "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex."); 1629 1633 return NULL; 1630 1634 } … … 1637 1641 Info FunctionInfo(__func__); 1638 1642 // print all lines 1639 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl);1643 LOG(0, "Printing all boundary points for debugging:"); 1640 1644 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin(); PointRunner != PointsOnBoundary.end(); PointRunner++) 1641 DoLog(0) && (Log() << Verbose(0) << *(PointRunner->second) << endl);1645 LOG(0, *(PointRunner->second)); 1642 1646 } 1643 1647 ; … … 1647 1651 Info FunctionInfo(__func__); 1648 1652 // print all lines 1649 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl);1653 LOG(0, "Printing all boundary lines for debugging:"); 1650 1654 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 1651 DoLog(0) && (Log() << Verbose(0) << *(LineRunner->second) << endl);1655 LOG(0, *(LineRunner->second)); 1652 1656 } 1653 1657 ; … … 1657 1661 Info FunctionInfo(__func__); 1658 1662 // print all triangles 1659 DoLog(0) && (Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl);1663 LOG(0, "Printing all boundary triangles for debugging:"); 1660 1664 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 1661 DoLog(0) && (Log() << Verbose(0) << *(TriangleRunner->second) << endl);1665 LOG(0, *(TriangleRunner->second)); 1662 1666 } 1663 1667 ; … … 1682 1686 OtherBase = new class BoundaryLineSet(BPS, -1); 1683 1687 1684 DoLog(0) && (Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl);1685 DoLog(0) && (Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl);1688 LOG(0, "INFO: Current base line is " << *Base << "."); 1689 LOG(0, "INFO: Other base line is " << *OtherBase << "."); 1686 1690 1687 1691 // get the closest point on each line to the other line … … 1701 1705 1702 1706 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 1703 DoLog(0) && (Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl);1707 LOG(0, "REJECT: Both lines have an intersection: Nothing to do."); 1704 1708 return false; 1705 1709 } else { // check for sign against BaseLineNormal … … 1707 1711 BaseLineNormal.Zero(); 1708 1712 if (Base->triangles.size() < 2) { 1709 DoeLog(1) && (eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);1713 ELOG(1, "Less than two triangles are attached to this baseline!"); 1710 1714 return 0.; 1711 1715 } 1712 1716 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 1713 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);1717 LOG(1, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "."); 1714 1718 BaseLineNormal += (runner->second->NormalVector); 1715 1719 } … … 1717 1721 1718 1722 if (Distance.ScalarProduct(BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 1719 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl);1723 LOG(0, "ACCEPT: Other base line would be higher: Flipping baseline."); 1720 1724 // calculate volume summand as a general tetraeder 1721 1725 return volume; 1722 1726 } else { // Base higher than OtherBase -> do nothing 1723 DoLog(0) && (Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl);1727 LOG(0, "REJECT: Base line is higher: Nothing to do."); 1724 1728 return 0.; 1725 1729 } … … 1747 1751 BaseLineNormal.Zero(); 1748 1752 if (Base->triangles.size() < 2) { 1749 DoeLog(1) && (eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);1753 ELOG(1, "Less than two triangles are attached to this baseline!"); 1750 1754 return NULL; 1751 1755 } 1752 1756 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 1753 DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);1757 LOG(1, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "."); 1754 1758 BaseLineNormal += (runner->second->NormalVector); 1755 1759 } … … 1764 1768 i = 0; 1765 1769 m = 0; 1766 DoLog(0) && (Log() << Verbose(0) << "The four old lines are: "); 1770 1771 // print OldLines and OldPoints for debugging 1772 if (DoLog(0)) { 1773 std::stringstream output; 1774 output << "The four old lines are: "; 1775 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1776 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1777 if (runner->second->lines[j] != Base) // pick not the central baseline 1778 output << *runner->second->lines[j] << "\t"; 1779 LOG(0, output.str()); 1780 } 1781 if (DoLog(0)) { 1782 std::stringstream output; 1783 output << "The two old points are: "; 1784 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1785 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1786 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) // and neither of its endpoints 1787 output << *runner->second->endpoints[j] << "\t"; 1788 LOG(0, output.str()); 1789 } 1790 1791 // index OldLines and OldPoints 1767 1792 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1768 1793 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1769 if (runner->second->lines[j] != Base) {// pick not the central baseline1794 if (runner->second->lines[j] != Base) // pick not the central baseline 1770 1795 OldLines[i++] = runner->second->lines[j]; 1771 DoLog(0) && (Log() << Verbose(0) << *runner->second->lines[j] << "\t");1772 }1773 DoLog(0) && (Log() << Verbose(0) << endl);1774 DoLog(0) && (Log() << Verbose(0) << "The two old points are: ");1775 1796 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 1776 1797 for (int j = 0; j < 3; j++) // all of their endpoints and baselines 1777 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) {// and neither of its endpoints1798 if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) // and neither of its endpoints 1778 1799 OldPoints[m++] = runner->second->endpoints[j]; 1779 DoLog(0) && (Log() << Verbose(0) << *runner->second->endpoints[j] << "\t");1780 }1781 DoLog(0) && (Log() << Verbose(0) << endl);1782 1800 1783 1801 // check whether everything is in place to create new lines and triangles 1784 1802 if (i < 4) { 1785 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl);1803 ELOG(1, "We have not gathered enough baselines!"); 1786 1804 return NULL; 1787 1805 } 1788 1806 for (int j = 0; j < 4; j++) 1789 1807 if (OldLines[j] == NULL) { 1790 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl);1808 ELOG(1, "We have not gathered enough baselines!"); 1791 1809 return NULL; 1792 1810 } 1793 1811 for (int j = 0; j < 2; j++) 1794 1812 if (OldPoints[j] == NULL) { 1795 DoeLog(1) && (eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl);1813 ELOG(1, "We have not gathered enough endpoints!"); 1796 1814 return NULL; 1797 1815 } 1798 1816 1799 1817 // remove triangles and baseline removes itself 1800 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl);1818 LOG(0, "INFO: Deleting baseline " << *Base << " from global list."); 1801 1819 OldBaseLineNr = Base->Nr; 1802 1820 m = 0; … … 1807 1825 // .. then delete each triangle (which deletes the line as well) 1808 1826 for (list <BoundaryTriangleSet *>::iterator runner = TrianglesOfBase.begin(); !TrianglesOfBase.empty(); runner = TrianglesOfBase.begin()) { 1809 DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(*runner) << "." << endl);1827 LOG(0, "INFO: Deleting triangle " << *(*runner) << "."); 1810 1828 OldTriangleNrs[m++] = (*runner)->Nr; 1811 1829 RemoveTesselationTriangle((*runner)); … … 1818 1836 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 1819 1837 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 1820 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl);1838 LOG(0, "INFO: Created new baseline " << *NewLine << "."); 1821 1839 1822 1840 // construct new triangles with flipped baseline … … 1833 1851 BTS->GetNormalVector(BaseLineNormal); 1834 1852 AddTesselationTriangle(OldTriangleNrs[0]); 1835 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);1853 LOG(0, "INFO: Created new triangle " << *BTS << "."); 1836 1854 1837 1855 BLS[0] = (i == 2 ? OldLines[3] : OldLines[2]); … … 1841 1859 BTS->GetNormalVector(BaseLineNormal); 1842 1860 AddTesselationTriangle(OldTriangleNrs[1]); 1843 DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);1861 LOG(0, "INFO: Created new triangle " << *BTS << "."); 1844 1862 } else { 1845 DoeLog(0) && (eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl);1863 ELOG(0, "The four old lines do not connect, something's utterly wrong here!"); 1846 1864 return NULL; 1847 1865 } … … 1874 1892 N[i] = LC->n[i]; 1875 1893 } else { 1876 DoeLog(1) && (eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl);1894 ELOG(1, "Point " << *a << " is not found in cell " << LC->index << "."); 1877 1895 return; 1878 1896 } … … 1882 1900 Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1; 1883 1901 } 1884 DoLog(0) && (Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl);1902 LOG(0, "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], "); 1885 1903 1886 1904 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) … … 1888 1906 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 1889 1907 const TesselPointSTLList *List = LC->GetCurrentCell(); 1890 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1908 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 1891 1909 if (List != NULL) { 1892 1910 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 1915 1933 angle = AngleCheck.Angle(Oben); 1916 1934 if (angle < Storage[0]) { 1917 //L og() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0],Storage[1]);1918 DoLog(1) && (Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n");1935 //LOG(1, "INFO: Old values of Storage is " << Storage[0] << ", " << Storage[1]); 1936 LOG(1, "INFO: Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << "."); 1919 1937 OptCandidate = Candidate; 1920 1938 Storage[0] = angle; 1921 //L og() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);1939 //LOG(1, "INFO: Changing something in Storage is " << Storage[0] << ", " << Storage[1]); 1922 1940 } else { 1923 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;1941 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate); 1924 1942 } 1925 1943 } else { 1926 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;1944 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Refused due to Radius " << norm); 1927 1945 } 1928 1946 } else { 1929 //L og() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;1947 //LOG(1, "INFO: Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "."); 1930 1948 } 1931 1949 } 1932 1950 } else { 1933 DoLog(0) && (Log() << Verbose(0) << "Linked cell list is empty." << endl);1951 LOG(0, "Linked cell list is empty."); 1934 1952 } 1935 1953 } … … 1986 2004 TesselPoint *Candidate = NULL; 1987 2005 1988 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl);2006 LOG(1, "INFO: NormalVector of BaseTriangle is " << NormalVector << "."); 1989 2007 1990 2008 // copy old center … … 2008 2026 CircleRadius = RADIUS * RADIUS - radius; 2009 2027 CirclePlaneNormal.Normalize(); 2010 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);2028 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 2011 2029 2012 2030 // test whether old center is on the band's plane 2013 2031 if (fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) > HULLEPSILON) { 2014 DoeLog(1) && (eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) << "!" << endl);2032 ELOG(1, "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(CirclePlaneNormal)) << "!"); 2015 2033 RelativeOldSphereCenter.ProjectOntoPlane(CirclePlaneNormal); 2016 2034 } 2017 2035 radius = RelativeOldSphereCenter.NormSquared(); 2018 2036 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2019 DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl);2037 LOG(1, "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "."); 2020 2038 2021 2039 // check SearchDirection 2022 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);2040 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 2023 2041 if (fabs(RelativeOldSphereCenter.ScalarProduct(SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2024 DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl);2042 ELOG(1, "SearchDirection and RelativeOldSphereCenter are not orthogonal!"); 2025 2043 } 2026 2044 … … 2029 2047 for (int i = 0; i < NDIM; i++) // store indices of this cell 2030 2048 N[i] = LC->n[i]; 2031 //L og() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2049 //LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 2032 2050 } else { 2033 DoeLog(1) && (eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl);2051 ELOG(1, "Vector " << CircleCenter << " is outside of LinkedCell's bounding box."); 2034 2052 return; 2035 2053 } 2036 2054 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2037 //Log() << Verbose(1) << "LC Intervals:"; 2055 // if (DoLog(0)) { 2056 // std::stringstream output; 2057 // output << "LC Intervals:"; 2058 // for (int i = 0; i < NDIM; i++) 2059 // output << " [" << Nlower[i] << "," << Nupper[i] << "] "; 2060 // LOG(0, output.str()); 2061 // } 2038 2062 for (int i = 0; i < NDIM; i++) { 2039 2063 Nlower[i] = ((N[i] - 1) >= 0) ? N[i] - 1 : 0; 2040 2064 Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1; 2041 //Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";2042 2065 } 2043 //Log() << Verbose(0) << endl;2044 2066 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 2045 2067 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2046 2068 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2047 2069 const TesselPointSTLList *List = LC->GetCurrentCell(); 2048 //L og() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2070 //LOG(1, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "."); 2049 2071 if (List != NULL) { 2050 2072 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2052 2074 2053 2075 // check for three unique points 2054 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl);2076 LOG(2, "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "."); 2055 2077 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node)) { 2056 2078 2057 2079 // find center on the plane 2058 2080 GetCenterofCircumcircle(NewPlaneCenter, CandidateLine.BaseLine->endpoints[0]->node->getPosition(), CandidateLine.BaseLine->endpoints[1]->node->getPosition(), Candidate->getPosition()); 2059 DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);2081 LOG(1, "INFO: NewPlaneCenter is " << NewPlaneCenter << "."); 2060 2082 2061 2083 try { … … 2063 2085 (CandidateLine.BaseLine->endpoints[1]->node->getPosition()), 2064 2086 (Candidate->getPosition())).getNormal(); 2065 DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);2087 LOG(1, "INFO: NewNormalVector is " << NewNormalVector << "."); 2066 2088 radius = CandidateLine.BaseLine->endpoints[0]->node->DistanceSquared(NewPlaneCenter); 2067 DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);2068 DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);2069 DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);2089 LOG(1, "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "."); 2090 LOG(1, "INFO: SearchDirection is " << SearchDirection << "."); 2091 LOG(1, "INFO: Radius of CircumCenterCircle is " << radius << "."); 2070 2092 if (radius < RADIUS * RADIUS) { 2071 2093 otherradius = CandidateLine.BaseLine->endpoints[1]->node->DistanceSquared(NewPlaneCenter); … … 2076 2098 helper = NewNormalVector; 2077 2099 helper.Scale(sqrt(RADIUS * RADIUS - radius)); 2078 DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl);2100 LOG(2, "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "."); 2079 2101 NewSphereCenter += helper; 2080 DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl);2102 LOG(2, "INFO: NewSphereCenter is at " << NewSphereCenter << "."); 2081 2103 // OtherNewSphereCenter is created by the same vector just in the other direction 2082 2104 helper.Scale(-1.); 2083 2105 OtherNewSphereCenter += helper; 2084 DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);2106 LOG(2, "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "."); 2085 2107 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON); 2086 2108 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON); … … 2103 2125 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2104 2126 CandidateLine.pointlist.push_back(Candidate); 2105 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);2127 LOG(0, "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "."); 2106 2128 } else { 2107 2129 // remove all candidates from the list and then the list itself 2108 2130 CandidateLine.pointlist.clear(); 2109 2131 CandidateLine.pointlist.push_back(Candidate); 2110 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);2132 LOG(0, "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "."); 2111 2133 } 2112 2134 CandidateLine.ShortestAngle = alpha; 2113 DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);2135 LOG(0, "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now."); 2114 2136 } else { 2115 2137 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2116 DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl);2138 LOG(1, "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ."); 2117 2139 } else { 2118 DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl);2140 LOG(1, "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected."); 2119 2141 } 2120 2142 } 2121 2143 } else { 2122 DoeLog(0) && (eLog() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl);2144 ELOG(0, "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius)); 2123 2145 } 2124 2146 } else { 2125 DoLog(1) && (Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl);2147 LOG(1, "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "."); 2126 2148 } 2127 2149 } 2128 2150 catch (LinearDependenceException &excp){ 2129 L og() << Verbose(1) << boost::diagnostic_information(excp);2130 L og() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2151 LOG(1, boost::diagnostic_information(excp)); 2152 LOG(1, "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent."); 2131 2153 } 2132 2154 } else { 2133 2155 if (ThirdPoint != NULL) { 2134 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl);2156 LOG(1, "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "."); 2135 2157 } else { 2136 DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl);2158 LOG(1, "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "."); 2137 2159 } 2138 2160 } … … 2141 2163 } 2142 2164 } else { 2143 DoeLog(1) && (eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);2165 ELOG(1, "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "."); 2144 2166 } 2145 2167 } else { 2146 2168 if (ThirdPoint != NULL) 2147 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl);2169 LOG(1, "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!"); 2148 2170 else 2149 DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl);2150 } 2151 2152 DoLog(1) && (Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl);2171 LOG(1, "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!"); 2172 } 2173 2174 LOG(1, "INFO: Sorting candidate list ..."); 2153 2175 if (CandidateLine.pointlist.size() > 1) { 2154 2176 CandidateLine.pointlist.unique(); … … 2157 2179 2158 2180 if ((!CandidateLine.pointlist.empty()) && (!CandidateLine.CheckValidity(RADIUS, LC))) { 2159 DoeLog(0) && (eLog() << Verbose(0) << "There were other points contained in the rolling sphere as well!" << endl);2181 ELOG(0, "There were other points contained in the rolling sphere as well!"); 2160 2182 performCriticalExit(); 2161 2183 } … … 2181 2203 if (!OrderTest.second) { // if insertion fails, we have common endpoint 2182 2204 node = OrderTest.first->second; 2183 DoLog(1) && (Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl);2205 LOG(1, "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "."); 2184 2206 j = 2; 2185 2207 i = 2; … … 2203 2225 2204 2226 if (LinesOnBoundary.empty()) { 2205 DoeLog(1) && (eLog() << Verbose(1) << "There is no tesselation structure to compare the point with, please create one first." << endl);2227 ELOG(1, "There is no tesselation structure to compare the point with, please create one first."); 2206 2228 return NULL; 2207 2229 } … … 2211 2233 for (int i = 0; i < NDIM; i++) // store indices of this cell 2212 2234 N[i] = LC->n[i]; 2213 DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);2235 LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 2214 2236 DistanceToPointMap * points = new DistanceToPointMap; 2215 2237 LC->GetNeighbourBounds(Nlower, Nupper); 2216 //Log() << Verbose(1) << endl;2217 2238 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 2218 2239 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2219 2240 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2220 2241 const TesselPointSTLList *List = LC->GetCurrentCell(); 2221 //L og() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;2242 //LOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2]); 2222 2243 if (List != NULL) { 2223 2244 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2225 2246 if (FindPoint != PointsOnBoundary.end()) { 2226 2247 points->insert(DistanceToPointPair(FindPoint->second->node->DistanceSquared(x), FindPoint->second)); 2227 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);2248 LOG(1, "INFO: Putting " << *FindPoint->second << " into the list."); 2228 2249 } 2229 2250 } 2230 2251 } else { 2231 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);2252 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 2232 2253 } 2233 2254 } … … 2235 2256 // check whether we found some points 2236 2257 if (points->empty()) { 2237 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2258 ELOG(1, "There is no nearest point: too far away from the surface."); 2238 2259 delete (points); 2239 2260 return NULL; … … 2254 2275 DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x, LC); 2255 2276 if (points == NULL) { 2256 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2277 ELOG(1, "There is no nearest point: too far away from the surface."); 2257 2278 return NULL; 2258 2279 } 2259 2280 2260 2281 // for each point, check its lines, remember closest 2261 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << x << " ... " << endl);2282 LOG(1, "Finding closest BoundaryLine to " << x << " ... "); 2262 2283 BoundaryLineSet *ClosestLine = NULL; 2263 2284 double MinDistance = -1.; … … 2284 2305 ClosestLine = LineRunner->second; 2285 2306 MinDistance = distance; 2286 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl);2307 LOG(1, "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "."); 2287 2308 } else { 2288 DoLog(1) && (Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl);2309 LOG(1, "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "."); 2289 2310 } 2290 2311 } else { 2291 DoLog(1) && (Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl);2312 LOG(1, "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "."); 2292 2313 } 2293 2314 } … … 2296 2317 // check whether closest line is "too close" :), then it's inside 2297 2318 if (ClosestLine == NULL) { 2298 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);2319 LOG(0, "Is the only point, no one else is closeby."); 2299 2320 return NULL; 2300 2321 } … … 2314 2335 DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x, LC); 2315 2336 if (points == NULL) { 2316 DoeLog(1) && (eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl);2337 ELOG(1, "There is no nearest point: too far away from the surface."); 2317 2338 return NULL; 2318 2339 } 2319 2340 2320 2341 // for each point, check its lines, remember closest 2321 DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << x << " ... " << endl);2342 LOG(1, "Finding closest BoundaryTriangle to " << x << " ... "); 2322 2343 LineSet ClosestLines; 2323 2344 double MinDistance = 1e+16; … … 2345 2366 ClosestLines.insert(LineRunner->second); 2346 2367 MinDistance = lengthEnd; 2347 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl);2368 LOG(1, "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "."); 2348 2369 } else if (fabs(lengthEnd - MinDistance) < MYEPSILON) { // additional best candidate 2349 2370 ClosestLines.insert(LineRunner->second); 2350 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl);2371 LOG(1, "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "."); 2351 2372 } else { // line is worse 2352 DoLog(1) && (Log() << Verbose(1) << "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "." << endl);2373 LOG(1, "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "."); 2353 2374 } 2354 2375 } else { // intersection is closer, calculate … … 2360 2381 const double distance = BaseLineIntersection.NormSquared(); 2361 2382 if (Center.NormSquared() > BaseLine.NormSquared()) { 2362 DoeLog(0) && (eLog() << Verbose(0) << "Algorithmic error: In second case we have intersection outside of baseline!" << endl);2383 ELOG(0, "Algorithmic error: In second case we have intersection outside of baseline!"); 2363 2384 } 2364 2385 if ((ClosestLines.empty()) || (distance < MinDistance)) { 2365 2386 ClosestLines.insert(LineRunner->second); 2366 2387 MinDistance = distance; 2367 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl);2388 LOG(1, "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "."); 2368 2389 } else { 2369 DoLog(2) && (Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl);2390 LOG(2, "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "."); 2370 2391 } 2371 2392 } … … 2376 2397 // check whether closest line is "too close" :), then it's inside 2377 2398 if (ClosestLines.empty()) { 2378 DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);2399 LOG(0, "Is the only point, no one else is closeby."); 2379 2400 return NULL; 2380 2401 } … … 2416 2437 result = *Runner; 2417 2438 MinAlignment = Alignment; 2418 DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl);2439 LOG(1, "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "."); 2419 2440 } else { 2420 DoLog(1) && (Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl);2441 LOG(1, "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "."); 2421 2442 } 2422 2443 } … … 2471 2492 2472 2493 if (triangle == NULL) {// is boundary point or only point in point cloud? 2473 DoLog(1) && (Log() << Verbose(1) << "No triangle given!" << endl);2494 LOG(1, "No triangle given!"); 2474 2495 return -1.; 2475 2496 } else { 2476 DoLog(1) && (Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl);2497 LOG(1, "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "."); 2477 2498 } 2478 2499 2479 2500 triangle->GetCenter(Center); 2480 DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);2501 LOG(2, "INFO: Central point of the triangle is " << Center << "."); 2481 2502 DistanceToCenter = Center - Point; 2482 DoLog(2) && (Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl);2503 LOG(2, "INFO: Vector from point to test to center is " << DistanceToCenter << "."); 2483 2504 2484 2505 // check whether we are on boundary … … 2487 2508 DistanceToCenter = Point + triangle->NormalVector; // points outside 2488 2509 Center = Point - triangle->NormalVector; // points towards MolCenter 2489 DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);2510 LOG(1, "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "."); 2490 2511 if (triangle->GetIntersectionInsideTriangle(Center, DistanceToCenter, Intersection)) { 2491 DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);2512 LOG(1, Point << " is inner point: sufficiently close to boundary, " << Intersection << "."); 2492 2513 return 0.; 2493 2514 } else { 2494 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl);2515 LOG(1, Point << " is NOT an inner point: on triangle plane but outside of triangle bounds."); 2495 2516 return false; 2496 2517 } … … 2498 2519 // calculate smallest distance 2499 2520 distance = triangle->GetClosestPointInsideTriangle(Point, Intersection); 2500 DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);2521 LOG(1, "Closest point on triangle is " << Intersection << "."); 2501 2522 2502 2523 // then check direction to boundary 2503 2524 if (DistanceToCenter.ScalarProduct(triangle->NormalVector) > MYEPSILON) { 2504 DoLog(1) && (Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl);2525 LOG(1, Point << " is an inner point, " << distance << " below surface."); 2505 2526 return -distance; 2506 2527 } else { 2507 DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl);2528 LOG(1, Point << " is NOT an inner point, " << distance << " above surface."); 2508 2529 return +distance; 2509 2530 } … … 2560 2581 ReferencePoint = PointRunner->second; 2561 2582 } else { 2562 DoeLog(2) && (eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);2583 ELOG(2, "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "."); 2563 2584 ReferencePoint = NULL; 2564 2585 } … … 2585 2606 2586 2607 if (takePoint) { 2587 DoLog(1) && (Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl);2608 LOG(1, "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted."); 2588 2609 connectedPoints->insert(current); 2589 2610 } … … 2593 2614 2594 2615 if (connectedPoints->empty()) { // if have not found any points 2595 DoeLog(1) && (eLog() << Verbose(1) << "We have not found any connected points to " << *Point << "." << endl);2616 ELOG(1, "We have not found any connected points to " << *Point << "."); 2596 2617 return NULL; 2597 2618 } … … 2626 2647 2627 2648 if (SetOfNeighbours == NULL) { 2628 DoeLog(2) && (eLog() << Verbose(2) << "Could not find any connected points!" << endl);2649 ELOG(2, "Could not find any connected points!"); 2629 2650 delete (connectedCircle); 2630 2651 return NULL; … … 2637 2658 PlaneNormal += (*Runner)->NormalVector; 2638 2659 } else { 2639 DoeLog(0) && (eLog() << Verbose(0) << "Could not find any triangles for point " << *Point << "." << endl);2660 ELOG(0, "Could not find any triangles for point " << *Point << "."); 2640 2661 performCriticalExit(); 2641 2662 } 2642 2663 PlaneNormal.Scale(1.0 / triangles->size()); 2643 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl);2664 LOG(1, "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "."); 2644 2665 PlaneNormal.Normalize(); 2645 2666 … … 2648 2669 AngleZero.ProjectOntoPlane(PlaneNormal); 2649 2670 if ((AngleZero.NormSquared() < MYEPSILON)) { 2650 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);2671 LOG(1, "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer."); 2651 2672 AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition()); 2652 2673 AngleZero.ProjectOntoPlane(PlaneNormal); 2653 2674 if (AngleZero.NormSquared() < MYEPSILON) { 2654 DoeLog(0) && (eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);2675 ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!"); 2655 2676 performCriticalExit(); 2656 2677 } 2657 2678 } 2658 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);2679 LOG(1, "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "."); 2659 2680 if (AngleZero.NormSquared() > MYEPSILON) 2660 2681 OrthogonalVector = Plane(PlaneNormal, AngleZero,0).getNormal(); 2661 2682 else 2662 2683 OrthogonalVector.MakeNormalTo(PlaneNormal); 2663 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);2684 LOG(1, "INFO: OrthogonalVector on plane is " << OrthogonalVector << "."); 2664 2685 2665 2686 // go through all connected points and calculate angle … … 2668 2689 helper.ProjectOntoPlane(PlaneNormal); 2669 2690 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 2670 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl);2691 LOG(0, "INFO: Calculated angle is " << angle << " for point " << **listRunner << "."); 2671 2692 anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 2672 2693 } … … 2702 2723 2703 2724 if (SetOfNeighbours == NULL) { 2704 DoeLog(2) && (eLog() << Verbose(2) << "Could not find any connected points!" << endl);2725 ELOG(2, "Could not find any connected points!"); 2705 2726 delete (connectedCircle); 2706 2727 return NULL; … … 2714 2735 } 2715 2736 2716 DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << Reference << "." << endl);2737 LOG(1, "INFO: Point is " << *Point << " and Reference is " << Reference << "."); 2717 2738 // calculate central point 2718 2739 TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin(); … … 2727 2748 ((*TesselB)->getPosition()), 2728 2749 ((*TesselC)->getPosition())).getNormal(); 2729 DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);2750 LOG(0, "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper); 2730 2751 counter++; 2731 2752 TesselA++; … … 2734 2755 PlaneNormal += helper; 2735 2756 } 2736 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2737 // << "; scale factor " << counter; 2757 //LOG(0, "Summed vectors " << center << "; number of points " << connectedPoints.size() << "; scale factor " << counter); 2738 2758 PlaneNormal.Scale(1.0 / (double) counter); 2739 // L og() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;2759 // LOG(1, "INFO: Calculated center of all circle points is " << center << "."); 2740 2760 // 2741 2761 // // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 2743 2763 // PlaneNormal.SubtractVector(¢er); 2744 2764 // PlaneNormal.Normalize(); 2745 DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl);2765 LOG(1, "INFO: Calculated plane normal of circle is " << PlaneNormal << "."); 2746 2766 2747 2767 // construct one orthogonal vector … … 2751 2771 } 2752 2772 if ((Reference.IsZero()) || (AngleZero.NormSquared() < MYEPSILON )) { 2753 DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);2773 LOG(1, "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer."); 2754 2774 AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition()); 2755 2775 AngleZero.ProjectOntoPlane(PlaneNormal); 2756 2776 if (AngleZero.NormSquared() < MYEPSILON) { 2757 DoeLog(0) && (eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);2777 ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!"); 2758 2778 performCriticalExit(); 2759 2779 } 2760 2780 } 2761 DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);2781 LOG(1, "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "."); 2762 2782 if (AngleZero.NormSquared() > MYEPSILON) 2763 2783 OrthogonalVector = Plane(PlaneNormal, AngleZero,0).getNormal(); 2764 2784 else 2765 2785 OrthogonalVector.MakeNormalTo(PlaneNormal); 2766 DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);2786 LOG(1, "INFO: OrthogonalVector on plane is " << OrthogonalVector << "."); 2767 2787 2768 2788 // go through all connected points and calculate angle … … 2774 2794 if (angle > M_PI) // the correction is of no use here (and not desired) 2775 2795 angle = 2. * M_PI - angle; 2776 DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl);2796 LOG(0, "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "."); 2777 2797 InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner))); 2778 2798 if (!InserterTest.second) { 2779 DoeLog(0) && (eLog() << Verbose(0) << "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner) << endl);2799 ELOG(0, "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner)); 2780 2800 performCriticalExit(); 2781 2801 } … … 2816 2836 ReferencePoint = PointRunner->second; 2817 2837 } else { 2818 DoeLog(1) && (eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);2838 ELOG(1, "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "."); 2819 2839 return NULL; 2820 2840 } … … 2833 2853 LineRunner = TouchedLine.find(runner->second); 2834 2854 if (LineRunner == TouchedLine.end()) { 2835 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl);2855 ELOG(1, "I could not find " << *runner->second << " in the touched list."); 2836 2856 } else if (!LineRunner->second) { 2837 2857 LineRunner->second = true; … … 2841 2861 StartLine = CurrentLine; 2842 2862 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 2843 DoLog(1) && (Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl);2863 LOG(1, "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "."); 2844 2864 do { 2845 2865 // push current one 2846 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);2866 LOG(1, "INFO: Putting " << *CurrentPoint << " at end of path."); 2847 2867 connectedPath->push_back(CurrentPoint->node); 2848 2868 2849 2869 // find next triangle 2850 2870 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 2851 DoLog(1) && (Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl);2871 LOG(1, "INFO: Inspecting triangle " << *Runner->second << "."); 2852 2872 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 2853 2873 triangle = Runner->second; … … 2856 2876 if (!TriangleRunner->second) { 2857 2877 TriangleRunner->second = true; 2858 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl);2878 LOG(1, "INFO: Connecting triangle is " << *triangle << "."); 2859 2879 break; 2860 2880 } else { 2861 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl);2881 LOG(1, "INFO: Skipping " << *triangle << ", as we have already visited it."); 2862 2882 triangle = NULL; 2863 2883 } 2864 2884 } else { 2865 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl);2885 ELOG(1, "I could not find " << *triangle << " in the touched list."); 2866 2886 triangle = NULL; 2867 2887 } … … 2874 2894 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 2875 2895 CurrentLine = triangle->lines[i]; 2876 DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl);2896 LOG(1, "INFO: Connecting line is " << *CurrentLine << "."); 2877 2897 break; 2878 2898 } … … 2880 2900 LineRunner = TouchedLine.find(CurrentLine); 2881 2901 if (LineRunner == TouchedLine.end()) 2882 DoeLog(1) && (eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl);2902 ELOG(1, "I could not find " << *CurrentLine << " in the touched list."); 2883 2903 else 2884 2904 LineRunner->second = true; … … 2888 2908 } while (CurrentLine != StartLine); 2889 2909 // last point is missing, as it's on start line 2890 DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);2910 LOG(1, "INFO: Putting " << *CurrentPoint << " at end of path."); 2891 2911 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 2892 2912 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 2894 2914 ListOfPaths->push_back(connectedPath); 2895 2915 } else { 2896 DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl);2916 LOG(1, "INFO: Skipping " << *runner->second << ", as we have already visited it."); 2897 2917 } 2898 2918 } 2899 2919 } else { 2900 DoeLog(1) && (eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl);2920 ELOG(1, "There are no lines attached to " << *ReferencePoint << "."); 2901 2921 } 2902 2922 … … 2924 2944 connectedPath = *ListRunner; 2925 2945 2926 DoLog(1) && (Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl);2946 LOG(1, "INFO: Current path is " << connectedPath << "."); 2927 2947 2928 2948 // go through list, look for reappearance of starting Point and count … … 2933 2953 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 2934 2954 // we have a closed circle from Marker to new Marker 2935 DoLog(1) && (Log() << Verbose(1) << count + 1 << ". closed path consists of: "); 2955 if (DoLog(1)) { 2956 std::stringstream output; 2957 output << count + 1 << ". closed path consists of: "; 2958 for (TesselPointList::iterator CircleSprinter = Marker; 2959 CircleSprinter != CircleRunner; 2960 CircleSprinter++) 2961 output << (**CircleSprinter) << " <-> "; 2962 LOG(1, output.str()); 2963 } 2936 2964 newPath = new TesselPointList; 2937 2965 TesselPointList::iterator CircleSprinter = Marker; 2938 for (; CircleSprinter != CircleRunner; CircleSprinter++) {2966 for (; CircleSprinter != CircleRunner; CircleSprinter++) 2939 2967 newPath->push_back(*CircleSprinter); 2940 DoLog(0) && (Log() << Verbose(0) << (**CircleSprinter) << " <-> ");2941 }2942 DoLog(0) && (Log() << Verbose(0) << ".." << endl);2943 2968 count++; 2944 2969 Marker = CircleRunner; … … 2949 2974 } 2950 2975 } 2951 DoLog(1) && (Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl);2976 LOG(1, "INFO: " << count << " closed additional path(s) have been created."); 2952 2977 2953 2978 // delete list of paths … … 2975 3000 2976 3001 if (Point == NULL) { 2977 DoeLog(1) && (eLog() << Verbose(1) << "Point given is NULL." << endl);3002 ELOG(1, "Point given is NULL."); 2978 3003 } else { 2979 3004 // go through its lines and insert all triangles … … 3008 3033 3009 3034 if (point == NULL) { 3010 DoeLog(1) && (eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl);3035 ELOG(1, "Cannot remove the point " << point << ", it's NULL!"); 3011 3036 return 0.; 3012 3037 } else 3013 DoLog(0) && (Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl);3038 LOG(0, "Removing point " << *point << " from tesselated boundary ..."); 3014 3039 3015 3040 // copy old location for the volume … … 3018 3043 // get list of connected points 3019 3044 if (point->lines.empty()) { 3020 DoeLog(1) && (eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl);3045 ELOG(1, "Cannot remove the point " << *point << ", it's connected to no lines!"); 3021 3046 return 0.; 3022 3047 } … … 3041 3066 NormalVector.Zero(); 3042 3067 for (TriangleMap::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3043 DoLog(1) && (Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl);3068 LOG(1, "INFO: Removing triangle " << *(Runner->second) << "."); 3044 3069 NormalVector -= Runner->second->NormalVector; // has to point inward 3045 3070 RemoveTesselationTriangle(Runner->second); 3046 3071 count++; 3047 3072 } 3048 DoLog(1) && (Log() << Verbose(1) << count << " triangles were removed." << endl);3073 LOG(1, count << " triangles were removed."); 3049 3074 3050 3075 list<TesselPointList *>::iterator ListAdvance = ListOfClosedPaths->begin(); … … 3070 3095 smallestangle = 0.; 3071 3096 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3072 DoLog(1) && (Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);3097 LOG(1, "INFO: MiddleNode is " << **MiddleNode << "."); 3073 3098 // construct vectors to next and previous neighbour 3074 3099 StartNode = MiddleNode; … … 3076 3101 StartNode = connectedPath->end(); 3077 3102 StartNode--; 3078 //L og() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;3103 //LOG(3, "INFO: StartNode is " << **StartNode << "."); 3079 3104 Point = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition()); 3080 3105 StartNode = MiddleNode; … … 3082 3107 if (StartNode == connectedPath->end()) 3083 3108 StartNode = connectedPath->begin(); 3084 //L og() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;3109 //LOG(3, "INFO: EndNode is " << **StartNode << "."); 3085 3110 Reference = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition()); 3086 3111 OrthogonalVector = ((*MiddleNode)->getPosition()) - OldPoint; … … 3095 3120 MiddleNode = EndNode; 3096 3121 if (MiddleNode == connectedPath->end()) { 3097 DoeLog(0) && (eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl);3122 ELOG(0, "CRITICAL: Could not find a smallest angle!"); 3098 3123 performCriticalExit(); 3099 3124 } … … 3105 3130 if (EndNode == connectedPath->end()) 3106 3131 EndNode = connectedPath->begin(); 3107 DoLog(2) && (Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl);3108 DoLog(2) && (Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);3109 DoLog(2) && (Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl);3110 DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->getName() << ", " << (*MiddleNode)->getName() << " and " << (*EndNode)->getName() << "." << endl);3132 LOG(2, "INFO: StartNode is " << **StartNode << "."); 3133 LOG(2, "INFO: MiddleNode is " << **MiddleNode << "."); 3134 LOG(2, "INFO: EndNode is " << **EndNode << "."); 3135 LOG(1, "INFO: Attempting to create triangle " << (*StartNode)->getName() << ", " << (*MiddleNode)->getName() << " and " << (*EndNode)->getName() << "."); 3111 3136 TriangleCandidates[0] = *StartNode; 3112 3137 TriangleCandidates[1] = *MiddleNode; … … 3114 3139 triangle = GetPresentTriangle(TriangleCandidates); 3115 3140 if (triangle != NULL) { 3116 DoeLog(0) && (eLog() << Verbose(0) << "New triangle already present, skipping!" << endl);3141 ELOG(0, "New triangle already present, skipping!"); 3117 3142 StartNode++; 3118 3143 MiddleNode++; … … 3126 3151 continue; 3127 3152 } 3128 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle points." << endl);3153 LOG(3, "Adding new triangle points."); 3129 3154 AddTesselationPoint(*StartNode, 0); 3130 3155 AddTesselationPoint(*MiddleNode, 1); 3131 3156 AddTesselationPoint(*EndNode, 2); 3132 DoLog(3) && (Log() << Verbose(3) << "Adding new triangle lines." << endl);3157 LOG(3, "Adding new triangle lines."); 3133 3158 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3134 3159 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3145 3170 // prepare nodes for next triangle 3146 3171 StartNode = EndNode; 3147 DoLog(2) && (Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl);3172 LOG(2, "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "."); 3148 3173 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3149 3174 if (connectedPath->size() == 2) { // we are done … … 3152 3177 break; 3153 3178 } else if (connectedPath->size() < 2) { // something's gone wrong! 3154 DoeLog(0) && (eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl);3179 ELOG(0, "CRITICAL: There are only two endpoints left!"); 3155 3180 performCriticalExit(); 3156 3181 } else { … … 3181 3206 if (maxgain != 0) { 3182 3207 volume += maxgain; 3183 DoLog(1) && (Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl);3208 LOG(1, "Flipping baseline with highest volume" << **Candidate << "."); 3184 3209 OtherBase = FlipBaseline(*Candidate); 3185 3210 NewLines.erase(Candidate); … … 3192 3217 delete (connectedPath); 3193 3218 } 3194 DoLog(0) && (Log() << Verbose(0) << count << " triangles were created." << endl);3219 LOG(0, count << " triangles were created."); 3195 3220 } else { 3196 3221 while (!ListOfClosedPaths->empty()) { … … 3200 3225 delete (connectedPath); 3201 3226 } 3202 DoLog(0) && (Log() << Verbose(0) << "No need to create any triangles." << endl);3227 LOG(0, "No need to create any triangles."); 3203 3228 } 3204 3229 delete (ListOfClosedPaths); 3205 3230 3206 DoLog(0) && (Log() << Verbose(0) << "Removed volume is " << volume << "." << endl);3231 LOG(0, "Removed volume is " << volume << "."); 3207 3232 3208 3233 return volume; … … 3298 3323 } 3299 3324 default: 3300 DoeLog(0) && (eLog() << Verbose(0) << "Number of wildcards is greater than 3, cannot happen!" << endl);3325 ELOG(0, "Number of wildcards is greater than 3, cannot happen!"); 3301 3326 performCriticalExit(); 3302 3327 break; … … 3354 3379 // sanity check 3355 3380 if (LinesOnBoundary.empty()) { 3356 DoeLog(2) && (eLog() << Verbose(2) <<"FindAllDegeneratedTriangles() was called without any tesselation structure.");3381 ELOG(2, "FindAllDegeneratedTriangles() was called without any tesselation structure."); 3357 3382 return DegeneratedLines; 3358 3383 } … … 3369 3394 AllLines.clear(); 3370 3395 3371 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl);3396 LOG(0, "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines."); 3372 3397 IndexToIndex::iterator it; 3373 3398 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) { … … 3375 3400 const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second); 3376 3401 if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end()) 3377 DoLog(0) && (Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl);3402 LOG(0, *Line1->second << " => " << *Line2->second); 3378 3403 else 3379 DoeLog(1) && (eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl);3404 ELOG(1, "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!"); 3380 3405 } 3381 3406 … … 3417 3442 delete (DegeneratedLines); 3418 3443 3419 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl);3444 LOG(0, "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:"); 3420 3445 for (IndexToIndex::iterator it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3421 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);3446 LOG(0, (*it).first << " => " << (*it).second); 3422 3447 3423 3448 return DegeneratedTriangles; … … 3438 3463 // iterate over all degenerated triangles 3439 3464 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); !DegeneratedTriangles->empty(); TriangleKeyRunner = DegeneratedTriangles->begin()) { 3440 DoLog(0) && (Log() << Verbose(0) << "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "." << endl);3465 LOG(0, "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "."); 3441 3466 // both ways are stored in the map, only use one 3442 3467 if (TriangleKeyRunner->first > TriangleKeyRunner->second) … … 3495 3520 // erase the pair 3496 3521 count += (int) DegeneratedTriangles->erase(triangle->Nr); 3497 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl);3522 LOG(0, "RemoveDegeneratedTriangles() removes triangle " << *triangle << "."); 3498 3523 RemoveTesselationTriangle(triangle); 3499 3524 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 3500 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl);3525 LOG(0, "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "."); 3501 3526 RemoveTesselationTriangle(partnerTriangle); 3502 3527 } else { 3503 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure." << endl);3528 LOG(0, "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure."); 3504 3529 } 3505 3530 } … … 3508 3533 LastTriangle = NULL; 3509 3534 3510 DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl);3535 LOG(0, "RemoveDegeneratedTriangles() removed " << count << " triangles:"); 3511 3536 } 3512 3537 … … 3534 3559 NearestBoundaryPoint = PointRunner->second; 3535 3560 } else { 3536 DoeLog(1) && (eLog() << Verbose(1) << "I cannot find the boundary point." << endl);3561 ELOG(1, "I cannot find the boundary point."); 3537 3562 return; 3538 3563 } 3539 DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->getName() << "." << endl);3564 LOG(0, "Nearest point on boundary is " << NearestPoint->getName() << "."); 3540 3565 3541 3566 // go through its lines and find the best one to split … … 3569 3594 3570 3595 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 3571 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);3596 LOG(2, "Adding new triangle points."); 3572 3597 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3573 3598 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3574 3599 AddTesselationPoint(point, 2); 3575 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);3600 LOG(2, "Adding new triangle lines."); 3576 3601 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3577 3602 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3580 3605 BTS->GetNormalVector(TempTriangle->NormalVector); 3581 3606 BTS->NormalVector.Scale(-1.); 3582 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl);3607 LOG(1, "INFO: NormalVector of new triangle is " << BTS->NormalVector << "."); 3583 3608 AddTesselationTriangle(); 3584 3609 3585 3610 // create other side of this triangle and close both new sides of the first created triangle 3586 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);3611 LOG(2, "Adding new triangle points."); 3587 3612 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3588 3613 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3589 3614 AddTesselationPoint(point, 2); 3590 DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);3615 LOG(2, "Adding new triangle lines."); 3591 3616 AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0); 3592 3617 AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1); … … 3594 3619 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 3595 3620 BTS->GetNormalVector(TempTriangle->NormalVector); 3596 DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl);3621 LOG(1, "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "."); 3597 3622 AddTesselationTriangle(); 3598 3623 … … 3601 3626 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 3602 3627 if (BestLine == BTS->lines[i]) { 3603 DoeLog(0) && (eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl);3628 ELOG(0, "BestLine is same as found line, something's wrong here!"); 3604 3629 performCriticalExit(); 3605 3630 } … … 3634 3659 NameofTempFile.erase(npos, 1); 3635 3660 NameofTempFile.append(TecplotSuffix); 3636 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");3661 LOG(1, "INFO: Writing temporary non convex hull to file " << NameofTempFile << "."); 3637 3662 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3638 3663 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 3648 3673 NameofTempFile.erase(npos, 1); 3649 3674 NameofTempFile.append(Raster3DSuffix); 3650 DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");3675 LOG(1, "INFO: Writing temporary non convex hull to file " << NameofTempFile << "."); 3651 3676 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3652 3677 WriteRaster3dFile(tempstream, this, cloud); … … 3700 3725 pair<map<int, Vector *>::iterator, bool> TriangleInsertionTester; 3701 3726 for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) { 3702 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl);3727 LOG(0, "Current point is " << *Runner->second << "."); 3703 3728 map<int, Vector *> TriangleVectors; 3704 3729 // gather all NormalVectors 3705 DoLog(1) && (Log() << Verbose(1) << "Gathering triangles ..." << endl);3730 LOG(1, "Gathering triangles ..."); 3706 3731 for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++) 3707 3732 for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) { … … 3709 3734 TriangleInsertionTester = TriangleVectors.insert(pair<int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector))); 3710 3735 if (TriangleInsertionTester.second) 3711 DoLog(1) && (Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl);3736 LOG(1, " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list."); 3712 3737 } else { 3713 DoLog(1) && (Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl);3738 LOG(1, " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one."); 3714 3739 } 3715 3740 } 3716 3741 // check whether there are two that are parallel 3717 DoLog(1) && (Log() << Verbose(1) << "Finding two parallel triangles ..." << endl);3742 LOG(1, "Finding two parallel triangles ..."); 3718 3743 for (map<int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++) 3719 3744 for (map<int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++) 3720 3745 if (VectorWalker != VectorRunner) { // skip equals 3721 3746 const double SCP = VectorWalker->second->ScalarProduct(*VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles 3722 DoLog(1) && (Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl);3747 LOG(1, "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP); 3723 3748 if (fabs(SCP + 1.) < ParallelEpsilon) { 3724 3749 InsertionTester = EndpointCandidateList.insert((Runner->second)); 3725 3750 if (InsertionTester.second) 3726 DoLog(0) && (Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl);3751 LOG(0, " Adding " << *Runner->second << " to endpoint candidate list."); 3727 3752 // and break out of both loops 3728 3753 VectorWalker = TriangleVectors.end(); … … 3743 3768 Walker = *(EndpointCandidateList.begin()); 3744 3769 if (Current == NULL) { // create a new polygon with current candidate 3745 DoLog(0) && (Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl);3770 LOG(0, "Starting new polygon set at point " << *Walker); 3746 3771 Current = new BoundaryPolygonSet; 3747 3772 Current->endpoints.insert(Walker); … … 3756 3781 for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) { 3757 3782 OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker); 3758 DoLog(1) && (Log() << Verbose(1) << "Checking " << *OtherWalker << endl);3783 LOG(1, "Checking " << *OtherWalker); 3759 3784 set<BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker); 3760 3785 if (Finder != EndpointCandidateList.end()) { // found a connected partner 3761 DoLog(1) && (Log() << Verbose(1) << " Adding to polygon." << endl);3786 LOG(1, " Adding to polygon."); 3762 3787 Current->endpoints.insert(OtherWalker); 3763 3788 EndpointCandidateList.erase(Finder); // remove from candidates 3764 3789 ToCheckConnecteds.push(OtherWalker); // but check its partners too 3765 3790 } else { 3766 DoLog(1) && (Log() << Verbose(1) << " is not connected to " << *Walker << endl);3791 LOG(1, " is not connected to " << *Walker); 3767 3792 } 3768 3793 } 3769 3794 } 3770 3795 3771 DoLog(0) && (Log() << Verbose(0) << "Final polygon is " << *Current << endl);3796 LOG(0, "Final polygon is " << *Current); 3772 3797 ListofDegeneratedPolygons.insert(Current); 3773 3798 Current = NULL; … … 3776 3801 const int counter = ListofDegeneratedPolygons.size(); 3777 3802 3778 DoLog(0) && (Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl); 3779 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 3780 DoLog(0) && (Log() << Verbose(0) << " " << **PolygonRunner << endl); 3803 if (DoLog(0)) { 3804 std::stringstream output; 3805 output << "The following " << counter << " degenerated polygons have been found: "; 3806 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 3807 output << " " << **PolygonRunner; 3808 LOG(0, output.str()); 3809 } 3781 3810 3782 3811 /// 4. Go through all these degenerated polygons … … 3789 3818 // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do. 3790 3819 if (T->size() == 2) { 3791 DoLog(1) && (Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl);3820 LOG(1, " Skipping degenerated polygon, is just a (already simply degenerated) triangle."); 3792 3821 delete (T); 3793 3822 continue; … … 3799 3828 // connections to either polygon ... 3800 3829 if (T->size() % 2 != 0) { 3801 DoeLog(0) && (eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl);3830 ELOG(0, " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!"); 3802 3831 performCriticalExit(); 3803 3832 } … … 3805 3834 /// 4a. Get NormalVector for one side (this is "front") 3806 3835 NormalVector = (*TriangleWalker)->NormalVector; 3807 DoLog(1) && (Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl);3836 LOG(1, "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector); 3808 3837 TriangleWalker++; 3809 3838 TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator … … 3814 3843 triangle = *TriangleWalker; 3815 3844 TriangleSprinter++; 3816 DoLog(1) && (Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl);3845 LOG(1, "Current triangle to test for removal: " << *triangle); 3817 3846 if (triangle->NormalVector.ScalarProduct(NormalVector) < 0) { // if from other side, then delete and remove from list 3818 DoLog(1) && (Log() << Verbose(1) << " Removing ... " << endl);3847 LOG(1, " Removing ... "); 3819 3848 TriangleNrs.push(triangle->Nr); 3820 3849 T->erase(TriangleWalker); 3821 3850 RemoveTesselationTriangle(triangle); 3822 3851 } else 3823 DoLog(1) && (Log() << Verbose(1) << " Keeping ... " << endl);3852 LOG(1, " Keeping ... "); 3824 3853 } 3825 3854 /// 4c. Copy all "front" triangles but with inverse NormalVector 3826 3855 TriangleWalker = T->begin(); 3827 3856 while (TriangleWalker != T->end()) { // go through all front triangles 3828 DoLog(1) && (Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl);3857 LOG(1, " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector); 3829 3858 for (int i = 0; i < 3; i++) 3830 3859 AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i); … … 3833 3862 AddTesselationLine(NULL, NULL, TPS[1], TPS[2], 2); 3834 3863 if (TriangleNrs.empty()) 3835 DoeLog(0) && (eLog() << Verbose(0) << "No more free triangle numbers!" << endl);3864 ELOG(0, "No more free triangle numbers!"); 3836 3865 BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ... 3837 3866 AddTesselationTriangle(); // ... and add … … 3841 3870 } 3842 3871 if (!TriangleNrs.empty()) { 3843 DoeLog(0) && (eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl);3872 ELOG(0, "There have been less triangles created than removed!"); 3844 3873 } 3845 3874 delete (T); // remove the triangleset 3846 3875 } 3847 3876 IndexToIndex * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles(); 3848 DoLog(0) && (Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl);3877 LOG(0, "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:"); 3849 3878 IndexToIndex::iterator it; 3850 3879 for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++) 3851 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);3880 LOG(0, (*it).first << " => " << (*it).second); 3852 3881 delete (SimplyDegeneratedTriangles); 3853 3882 /// 5. exit -
src/Tesselation/tesselationhelpers.cpp
r50e4e5 r47d041 76 76 77 77 if (fabs(m11) < MYEPSILON) 78 DoeLog(1) && (eLog()<< Verbose(1) << "three points are colinear." << endl);78 ELOG(1, "three points are colinear."); 79 79 80 80 center->at(0) = 0.5 * m12/ m11; … … 83 83 84 84 if (fabs(a.distance(*center) - RADIUS) > MYEPSILON) 85 DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.distance(*center) - RADIUS) << " from a than RADIUS." << endl);85 ELOG(1, "The given center is further way by " << fabs(a.distance(*center) - RADIUS) << " from a than RADIUS."); 86 86 }; 87 87 … … 122 122 Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma))); 123 123 (*NewUmkreismittelpunkt) = (*Center); 124 DoLog(1) && (Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n");124 LOG(2, "INFO: Center of new circumference is " << *NewUmkreismittelpunkt << "."); 125 125 // Here we calculated center of circumscribing circle, using barycentric coordinates 126 DoLog(1) && (Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n");126 LOG(2, "INFO: Center of circumference is " << *Center << " in direction " << *Direction << "."); 127 127 128 128 TempNormal = a - b; … … 146 146 TempNormal.Normalize(); 147 147 Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius); 148 DoLog(1) && (Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n");148 LOG(2, "Height of center of circumference to center of sphere is " << Restradius << "."); 149 149 TempNormal.Scale(Restradius); 150 DoLog(1) && (Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n");150 LOG(2, "Shift vector to sphere of circumference is " << TempNormal << "."); 151 151 (*Center) += TempNormal; 152 DoLog(1) && (Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n");152 LOG(2, "Center of sphere of circumference is " << *Center << "."); 153 153 GetSphere(&OtherCenter, a, b, c, RADIUS); 154 DoLog(1) && (Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n");154 LOG(2, "OtherCenter of sphere of circumference is " << OtherCenter << "."); 155 155 }; 156 156 … … 180 180 if (fabs(helper[0]+helper[1]+helper[2]) > MYEPSILON) 181 181 Center.Scale(1./(helper[0]+helper[1]+helper[2])); 182 L og() << Verbose(1) << "INFO: Center (2nd algo) is at " << Center << "." << endl;182 LOG(1, "INFO: Center (2nd algo) is at " << Center << "."); 183 183 }; 184 184 … … 208 208 // test whether new center is on the parameter circle's plane 209 209 if (fabs(helper.ScalarProduct(CirclePlaneNormal)) > HULLEPSILON) { 210 DoeLog(1) && (eLog()<< Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(CirclePlaneNormal)) << "!" << endl);210 ELOG(1, "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(CirclePlaneNormal)) << "!"); 211 211 helper.ProjectOntoPlane(CirclePlaneNormal); 212 212 } … … 214 214 // test whether the new center vector has length of CircleRadius 215 215 if (fabs(radius - CircleRadius) > HULLEPSILON) 216 DoeLog(1) && (eLog()<< Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);216 ELOG(1, "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "."); 217 217 alpha = helper.Angle(RelativeOldSphereCenter); 218 218 // make the angle unique by checking the halfplanes/search direction 219 219 if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON) // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals 220 220 alpha = 2.*M_PI - alpha; 221 DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl);221 LOG(1, "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "."); 222 222 radius = helper.distance(RelativeOldSphereCenter); 223 223 helper.ProjectOntoPlane(NormalVector); 224 224 // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles 225 225 if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) { 226 DoLog(1) && (Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl);226 LOG(1, "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "."); 227 227 return alpha; 228 228 } else { 229 DoLog(1) && (Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl);229 LOG(1, "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "."); 230 230 return 2.*M_PI; 231 231 } … … 262 262 } 263 263 264 DoLog(1) && (Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl);264 LOG(1, "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "."); 265 265 266 266 return phi; … … 329 329 for (int j=i+1; j<3; j++) { 330 330 if (nodes[i] == NULL) { 331 DoLog(1) && (Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl);331 LOG(1, "Node nr. " << i << " is not yet present."); 332 332 result = true; 333 333 } else if (nodes[i]->lines.find(nodes[j]->node->getNr()) != nodes[i]->lines.end()) { // there already is a line … … 343 343 } 344 344 } else { // no line 345 DoLog(1) && (Log() << Verbose(1) << "The line between " << *nodes[i] << " and " << *nodes[j] << " is not yet present, hence no need for a degenerate triangle." << endl);345 LOG(1, "The line between " << *nodes[i] << " and " << *nodes[j] << " is not yet present, hence no need for a degenerate triangle."); 346 346 result = true; 347 347 } 348 348 } 349 349 if ((!result) && (counter > 1)) { 350 DoLog(1) && (Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl);350 LOG(1, "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used."); 351 351 result = true; 352 352 } … … 362 362 // Vector BaseLineVector, OrthogonalVector, helper; 363 363 // if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 364 // DoeLog(1) && (eLog()<< Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl);364 // ELOG(1, "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "."); 365 365 // //return false; 366 366 // exit(1); … … 393 393 // } 394 394 // 395 // L og() << Verbose(1) << *candidate1->point << " has angle " << phi << endl;396 // L og() << Verbose(1) << *candidate2->point << " has angle " << psi << endl;395 // LOG(1, *candidate1->point << " has angle " << phi); 396 // LOG(1, *candidate2->point << " has angle " << psi); 397 397 // 398 398 // // return comparison … … 421 421 for(int i=0;i<NDIM;i++) // store indices of this cell 422 422 N[i] = LC->n[i]; 423 DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);423 LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 424 424 425 425 LC->GetNeighbourBounds(Nlower, Nupper); 426 //Log() << Verbose(1) << endl;427 426 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 428 427 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 429 428 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 430 429 const TesselPointSTLList *List = LC->GetCurrentCell(); 431 //L og() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;430 //LOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2]); 432 431 if (List != NULL) { 433 432 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 441 440 distance = currentNorm; 442 441 closestPoint = (*Runner); 443 //L og() << Verbose(2) << "INFO: New Second Nearest Neighbour is " << *secondClosestPoint << "." << endl;442 //LOG(2, "INFO: New Second Nearest Neighbour is " << *secondClosestPoint << "."); 444 443 } 445 444 } 446 445 } else { 447 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);446 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 448 447 } 449 448 } … … 474 473 for(int i=0;i<NDIM;i++) // store indices of this cell 475 474 N[i] = LC->n[i]; 476 DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);475 LOG(1, "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "."); 477 476 478 477 LC->GetNeighbourBounds(Nlower, Nupper); 479 //Log() << Verbose(1) << endl;480 478 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 481 479 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 482 480 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 483 481 const TesselPointSTLList *List = LC->GetCurrentCell(); 484 //L og() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;482 //LOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2]); 485 483 if (List != NULL) { 486 484 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 492 490 distance = currentNorm; 493 491 closestPoint = (*Runner); 494 //L og() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;492 //LOG(1, "INFO: New Nearest Neighbour is " << *closestPoint << "."); 495 493 } else if (currentNorm < secondDistance) { 496 494 secondDistance = currentNorm; 497 495 SecondPoint = (*Runner); 498 //L og() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;496 //LOG(1, "INFO: New Second Nearest Neighbour is " << *SecondPoint << "."); 499 497 } 500 498 } 501 499 } else { 502 DoeLog(1) && (eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);500 ELOG(1, "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!"); 503 501 } 504 502 } 505 503 // output 506 504 if (closestPoint != NULL) { 507 DoLog(1) && (Log() << Verbose(1) << "Closest point is " << *closestPoint); 508 if (SecondPoint != NULL) 509 DoLog(0) && (Log() << Verbose(0) << " and second closest is " << *SecondPoint); 510 DoLog(0) && (Log() << Verbose(0) << "." << endl); 505 if (DoLog(1)) { 506 std::stringstream output; 507 output << "Closest point is " << *closestPoint; 508 if (SecondPoint != NULL) 509 output << " and second closest is " << *SecondPoint; 510 LOG(0, output.str() << "."); 511 } 511 512 } 512 513 return closestPoint; … … 528 529 Normal.VectorProduct(OtherBaseline); 529 530 Normal.Normalize(); 530 DoLog(1) && (Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl);531 LOG(1, "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "."); 531 532 532 533 // project one offset point of OtherBase onto this plane (and add plane offset vector) … … 542 543 *Intersection = line1.getIntersection(line2); 543 544 Normal = (*Intersection) - (Base->endpoints[0]->node->getPosition()); 544 DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "." << endl);545 LOG(1, "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "."); 545 546 546 547 return Intersection; … … 577 578 Vector *center = cloud.GetCenter(); 578 579 if (vrmlfile != NULL) { 579 //Log() << Verbose(1) << "Writing Raster3D file ... ";580 LOG(1, "INFO: Writing Raster3D file ... "); 580 581 *vrmlfile << "#VRML V2.0 utf8" << endl; 581 582 *vrmlfile << "#Created by molecuilder" << endl; … … 603 604 } 604 605 } else { 605 DoeLog(1) && (eLog()<< Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl);606 ELOG(1, "Given vrmlfile is " << vrmlfile << "."); 606 607 } 607 608 delete(center); … … 649 650 Vector *center = cloud.GetCenter(); 650 651 if (rasterfile != NULL) { 651 //Log() << Verbose(1) << "Writing Raster3D file ... ";652 LOG(1, "INFO: Writing Raster3D file ... "); 652 653 *rasterfile << "# Raster3D object description, created by MoleCuilder" << endl; 653 654 *rasterfile << "@header.r3d" << endl; … … 681 682 *rasterfile << "9\n# terminating special property\n"; 682 683 } else { 683 DoeLog(1) && (eLog()<< Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl);684 ELOG(1, "Given rasterfile is " << rasterfile << "."); 684 685 } 685 686 IncludeSphereinRaster3D(rasterfile, Tess, cloud); … … 734 735 *tecplot << endl; 735 736 // print connectivity 736 DoLog(1) && (Log() << Verbose(1) << "The following triangles were created:" << endl);737 LOG(1, "The following triangles were created:"); 737 738 for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 738 DoLog(1) && (Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->getName() << "<->" << runner->second->endpoints[1]->node->getName() << "<->" << runner->second->endpoints[2]->node->getName() << endl);739 LOG(1, " " << runner->second->endpoints[0]->node->getName() << "<->" << runner->second->endpoints[1]->node->getName() << "<->" << runner->second->endpoints[2]->node->getName()); 739 740 *tecplot << LookupList[runner->second->endpoints[0]->node->getNr()] << " " << LookupList[runner->second->endpoints[1]->node->getNr()] << " " << LookupList[runner->second->endpoints[2]->node->getNr()] << endl; 740 741 } … … 761 762 for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { 762 763 point = PointRunner->second; 763 DoLog(1) && (Log() << Verbose(1) << "INFO: Current point is " << *point << "." << endl);764 LOG(1, "INFO: Current point is " << *point << "."); 764 765 765 766 // calculate mean concavity over all connected line … … 767 768 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 768 769 line = LineRunner->second; 769 //L og() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;770 //LOG(1, "INFO: Current line of point " << *point << " is " << *line << "."); 770 771 ConcavityPerLine -= line->CalculateConvexity(); 771 772 } … … 815 816 816 817 for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { 817 DoeLog(1) && (eLog() << Verbose(1) << "INFO: Current point is " << * PointRunner->second << "." << endl);818 ELOG(1, "INFO: Current point is " << * PointRunner->second << "."); 818 819 819 820 distance = 0.; … … 840 841 int counter = 0; 841 842 842 DoLog(1) && (Log() << Verbose(1) << "Check: List of Baselines with not two connected triangles:" << endl);843 LOG(1, "Check: List of Baselines with not two connected triangles:"); 843 844 for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) { 844 845 if (testline->second->triangles.size() != 2) { 845 DoLog(2) && (Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl);846 LOG(2, *testline->second << "\t" << testline->second->triangles.size()); 846 847 counter++; 847 848 } 848 849 } 849 850 if (counter == 0) { 850 DoLog(1) && (Log() << Verbose(1) << "None." << endl);851 LOG(1, "None."); 851 852 result = true; 852 853 } … … 863 864 // check number of endpoints in *P 864 865 if (P->endpoints.size() != 4) { 865 DoeLog(1) && (eLog()<< Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl);866 ELOG(1, "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!"); 866 867 return 0; 867 868 } … … 869 870 // check number of triangles in *T 870 871 if (T->size() < 2) { 871 DoeLog(1) && (eLog()<< Verbose(1) << "Not enough triangles to have pairs!" << endl);872 ELOG(1, "Not enough triangles to have pairs!"); 872 873 return 0; 873 874 } 874 875 875 DoLog(0) && (Log() << Verbose(0) << "Polygon is " << *P << endl);876 LOG(0, "Polygon is " << *P); 876 877 // create each pair, get the endpoints and check whether *P is contained. 877 878 int counter = 0; … … 889 890 const int size = PairTrianglenodes.endpoints.size(); 890 891 if (size == 4) { 891 DoLog(0) && (Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl);892 LOG(0, " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes); 892 893 // now check 893 894 if (PairTrianglenodes.ContainsPresentTupel(P)) { 894 895 counter++; 895 DoLog(0) && (Log() << Verbose(0) << " ACCEPT: Matches with " << *P << endl);896 LOG(0, " ACCEPT: Matches with " << *P); 896 897 } else { 897 DoLog(0) && (Log() << Verbose(0) << " REJECT: No match with " << *P << endl);898 LOG(0, " REJECT: No match with " << *P); 898 899 } 899 900 } else { 900 DoLog(0) && (Log() << Verbose(0) << " REJECT: Less than four endpoints." << endl);901 LOG(0, " REJECT: Less than four endpoints."); 901 902 } 902 903 } … … 919 920 if (P2->ContainsBoundaryPoint((*Runner))) { 920 921 counter++; 921 DoLog(1) && (Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl);922 LOG(1, *(*Runner) << " of second polygon is found in the first one."); 922 923 return true; 923 924 } … … 937 938 Tester = P1->endpoints.insert((*Runner)); 938 939 if (Tester.second) 939 DoLog(0) && (Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl);940 LOG(0, "Inserting endpoint " << *(*Runner) << " into first polygon."); 940 941 } 941 942 P2->endpoints.clear(); -
src/Tesselation/triangleintersectionlist.cpp
r50e4e5 r47d041 141 141 boost::scoped_ptr< DistanceToPointMap > points(Tess->FindClosestBoundaryPointsToVector(Point,Vicinity)); 142 142 if (points == NULL) { 143 DoeLog(1) && (eLog()<< Verbose(1) << "There is no nearest point: too far away from the surface." << endl);143 ELOG(1, "There is no nearest point: too far away from the surface."); 144 144 return; 145 145 } … … 157 157 Intersection = new Vector; 158 158 (*TriangleRunner)->GetClosestPointInsideTriangle(Point, *Intersection); 159 //L og() << Verbose(1) << "Intersection between " << Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;159 //LOG(1, "Intersection between " << Point << " and " << **TriangleRunner << " is at " << *Intersection << "."); 160 160 IntersectionList.insert( pair<BoundaryTriangleSet *, Vector * > (*TriangleRunner, Intersection) ); 161 161 } … … 172 172 173 173 //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++) 174 // L og() << Verbose(1) << (*runner).first << " away from " << *(*runner).second << endl;174 // LOG(1, (*runner).first << " away from " << *(*runner).second); 175 175 }; 176 176 -
src/Tesselation/unittests/Tesselation_InsideOutsideUnitTest.cpp
r50e4e5 r47d041 110 110 while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) { 111 111 // 2a. fill all new OpenLines 112 DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl);112 LOG(1, "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:"); 113 113 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 114 DoLog(2) && (Log() << Verbose(2) << *(Runner->second) << endl);114 LOG(2, *(Runner->second)); 115 115 116 116 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { … … 118 118 if (baseline->pointlist.empty()) { 119 119 T = (((baseline->BaseLine->triangles.begin()))->second); 120 DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);120 LOG(1, "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T); 121 121 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, SPHERERADIUS, LinkedList); //the line is there, so there is a triangle, but only one. 122 122 } … … 125 125 // 2b. search for smallest ShortestAngle among all candidates 126 126 double ShortestAngle = 4.*M_PI; 127 DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl);127 LOG(1, "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:"); 128 128 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 129 DoLog(2) && (Log() << Verbose(2) << *(Runner->second) << endl);129 LOG(2, *(Runner->second)); 130 130 131 131 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { … … 133 133 baseline = Runner->second; 134 134 ShortestAngle = baseline->ShortestAngle; 135 //L og() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;135 //LOG(1, "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle); 136 136 } 137 137 }
Note:
See TracChangeset
for help on using the changeset viewer.