Changes in src/tesselation.cpp [e138de:27bd2f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
re138de r27bd2f 9 9 10 10 #include "helpers.hpp" 11 #include "info.hpp" 11 12 #include "linkedcell.hpp" 12 13 #include "log.hpp" … … 22 23 /** Constructor of BoundaryPointSet. 23 24 */ 24 BoundaryPointSet::BoundaryPointSet() 25 { 26 LinesCount = 0; 27 Nr = -1; 28 value = 0.; 25 BoundaryPointSet::BoundaryPointSet() : 26 LinesCount(0), 27 value(0.), 28 Nr(-1) 29 { 30 Info FunctionInfo(__func__); 31 Log() << Verbose(1) << "Adding noname." << endl; 29 32 }; 30 33 … … 32 35 * \param *Walker TesselPoint this boundary point represents 33 36 */ 34 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) 35 { 36 node = Walker; 37 LinesCount = 0; 38 Nr = Walker->nr; 39 value = 0.; 37 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) : 38 LinesCount(0), 39 node(Walker), 40 value(0.), 41 Nr(Walker->nr) 42 { 43 Info FunctionInfo(__func__); 44 Log() << Verbose(1) << "Adding Node " << *Walker << endl; 40 45 }; 41 46 … … 46 51 BoundaryPointSet::~BoundaryPointSet() 47 52 { 48 //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl; 53 Info FunctionInfo(__func__); 54 //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl; 49 55 if (!lines.empty()) 50 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *this << " am still connected to some lines." << endl;56 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl; 51 57 node = NULL; 52 58 }; … … 57 63 void BoundaryPointSet::AddLine(class BoundaryLineSet *line) 58 64 { 59 Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "." 65 Info FunctionInfo(__func__); 66 Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." 60 67 << endl; 61 68 if (line->endpoints[0] == this) … … 85 92 /** Constructor of BoundaryLineSet. 86 93 */ 87 BoundaryLineSet::BoundaryLineSet() 88 { 94 BoundaryLineSet::BoundaryLineSet() : 95 Nr(-1) 96 { 97 Info FunctionInfo(__func__); 89 98 for (int i = 0; i < 2; i++) 90 99 endpoints[i] = NULL; 91 Nr = -1;92 100 }; 93 101 … … 99 107 BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number) 100 108 { 109 Info FunctionInfo(__func__); 101 110 // set number 102 111 Nr = number; … … 106 115 Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding. 107 116 Point[1]->AddLine(this); // 117 // set skipped to false 118 skipped = false; 108 119 // clear triangles list 109 Log() << Verbose( 5) << "New Line with endpoints " << *this << "." << endl;120 Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl; 110 121 }; 111 122 … … 116 127 BoundaryLineSet::~BoundaryLineSet() 117 128 { 129 Info FunctionInfo(__func__); 118 130 int Numbers[2]; 119 131 … … 134 146 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 135 147 if ((*Runner).second == this) { 136 //Log() << Verbose( 5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;148 //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 137 149 endpoints[i]->lines.erase(Runner); 138 150 break; … … 140 152 } else { // there's just a single line left 141 153 if (endpoints[i]->lines.erase(Nr)) { 142 //Log() << Verbose( 5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;154 //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 143 155 } 144 156 } 145 157 if (endpoints[i]->lines.empty()) { 146 //Log() << Verbose( 5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;158 //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl; 147 159 if (endpoints[i] != NULL) { 148 160 delete(endpoints[i]); … … 153 165 } 154 166 if (!triangles.empty()) 155 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *this << " am still connected to some triangles." << endl;167 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl; 156 168 }; 157 169 … … 161 173 void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle) 162 174 { 163 Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 175 Info FunctionInfo(__func__); 176 Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 164 177 triangles.insert(TrianglePair(triangle->Nr, triangle)); 165 178 }; … … 171 184 bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line) 172 185 { 186 Info FunctionInfo(__func__); 173 187 if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1])) 174 188 return true; … … 185 199 bool BoundaryLineSet::CheckConvexityCriterion() 186 200 { 201 Info FunctionInfo(__func__); 187 202 Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck; 188 203 // get the two triangles 189 204 if (triangles.size() != 2) { 190 Log() << Verbose(1) << "ERROR:Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;205 eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl; 191 206 return true; 192 207 } 193 208 // check normal vectors 194 209 // have a normal vector on the base line pointing outwards 195 //Log() << Verbose( 3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;210 //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl; 196 211 BaseLineCenter.CopyVector(endpoints[0]->node->node); 197 212 BaseLineCenter.AddVector(endpoints[1]->node->node); … … 199 214 BaseLine.CopyVector(endpoints[0]->node->node); 200 215 BaseLine.SubtractVector(endpoints[1]->node->node); 201 //Log() << Verbose( 3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;216 //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl; 202 217 203 218 BaseLineNormal.Zero(); … … 207 222 class BoundaryPointSet *node = NULL; 208 223 for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) { 209 //Log() << Verbose( 3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;224 //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl; 210 225 NormalCheck.AddVector(&runner->second->NormalVector); 211 226 NormalCheck.Scale(sign); … … 214 229 BaseLineNormal.CopyVector(&runner->second->NormalVector); // yes, copy second on top of first 215 230 else { 216 Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl; 217 exit(255); 231 eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl; 218 232 } 219 233 node = runner->second->GetThirdEndpoint(this); 220 234 if (node != NULL) { 221 //Log() << Verbose( 3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;235 //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl; 222 236 helper[i].CopyVector(node->node->node); 223 237 helper[i].SubtractVector(&BaseLineCenter); 224 238 helper[i].MakeNormalVector(&BaseLine); // we want to compare the triangle's heights' angles! 225 //Log() << Verbose( 4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;239 //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl; 226 240 i++; 227 241 } else { 228 //Log() << Verbose(2) << "ERROR:I cannot find third node in triangle, something's wrong." << endl;242 eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl; 229 243 return true; 230 244 } 231 245 } 232 //Log() << Verbose( 3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;246 //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl; 233 247 if (NormalCheck.NormSquared() < MYEPSILON) { 234 Log() << Verbose( 3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;248 Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl; 235 249 return true; 236 250 } … … 238 252 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 239 253 if ((angle - M_PI) > -MYEPSILON) { 240 Log() << Verbose( 3) << "ACCEPT: Angle is greater than pi: convex." << endl;254 Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl; 241 255 return true; 242 256 } else { 243 Log() << Verbose( 3) << "REJECT: Angle is less than pi: concave." << endl;257 Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl; 244 258 return false; 245 259 } … … 252 266 bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 253 267 { 268 Info FunctionInfo(__func__); 254 269 for(int i=0;i<2;i++) 255 270 if (point == endpoints[i]) … … 264 279 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point) 265 280 { 281 Info FunctionInfo(__func__); 266 282 if (endpoints[0] == point) 267 283 return endpoints[1]; … … 286 302 /** Constructor for BoundaryTriangleSet. 287 303 */ 288 BoundaryTriangleSet::BoundaryTriangleSet() 289 { 304 BoundaryTriangleSet::BoundaryTriangleSet() : 305 Nr(-1) 306 { 307 Info FunctionInfo(__func__); 290 308 for (int i = 0; i < 3; i++) 291 309 { … … 293 311 lines[i] = NULL; 294 312 } 295 Nr = -1;296 313 }; 297 314 … … 300 317 * \param number number of triangle 301 318 */ 302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) 303 { 319 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) : 320 Nr(number) 321 { 322 Info FunctionInfo(__func__); 304 323 // set number 305 Nr = number;306 324 // set lines 307 Log() << Verbose(5) << "New triangle " << Nr << ":" << endl; 308 for (int i = 0; i < 3; i++) 309 { 310 lines[i] = line[i]; 311 lines[i]->AddTriangle(this); 312 } 325 for (int i = 0; i < 3; i++) { 326 lines[i] = line[i]; 327 lines[i]->AddTriangle(this); 328 } 313 329 // get ascending order of endpoints 314 map<int, class BoundaryPointSet *>OrderMap;330 PointMap OrderMap; 315 331 for (int i = 0; i < 3; i++) 316 332 // for all three lines 317 for (int j = 0; j < 2; j++) 318 { // for both endpoints 319 OrderMap.insert(pair<int, class BoundaryPointSet *> ( 320 line[i]->endpoints[j]->Nr, line[i]->endpoints[j])); 321 // and we don't care whether insertion fails 322 } 333 for (int j = 0; j < 2; j++) { // for both endpoints 334 OrderMap.insert(pair<int, class BoundaryPointSet *> ( 335 line[i]->endpoints[j]->Nr, line[i]->endpoints[j])); 336 // and we don't care whether insertion fails 337 } 323 338 // set endpoints 324 339 int Counter = 0; 325 Log() << Verbose(6) << " with end points "; 326 for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner 327 != OrderMap.end(); runner++) 328 { 329 endpoints[Counter] = runner->second; 330 Log() << Verbose(0) << " " << *endpoints[Counter]; 331 Counter++; 332 } 333 if (Counter < 3) 334 { 335 eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!" 336 << endl; 337 //exit(1); 338 } 339 Log() << Verbose(0) << "." << endl; 340 Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl; 341 for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) { 342 endpoints[Counter] = runner->second; 343 Log() << Verbose(0) << " " << *endpoints[Counter] << endl; 344 Counter++; 345 } 346 if (Counter < 3) { 347 eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl; 348 performCriticalExit(); 349 } 340 350 }; 341 351 … … 346 356 BoundaryTriangleSet::~BoundaryTriangleSet() 347 357 { 358 Info FunctionInfo(__func__); 348 359 for (int i = 0; i < 3; i++) { 349 360 if (lines[i] != NULL) { 350 361 if (lines[i]->triangles.erase(Nr)) { 351 //Log() << Verbose( 5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;362 //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl; 352 363 } 353 364 if (lines[i]->triangles.empty()) { 354 //Log() << Verbose( 5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;365 //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl; 355 366 delete (lines[i]); 356 367 lines[i] = NULL; … … 358 369 } 359 370 } 360 //Log() << Verbose( 5) << "Erasing triangle Nr." << Nr << " itself." << endl;371 //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl; 361 372 }; 362 373 … … 367 378 void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector) 368 379 { 380 Info FunctionInfo(__func__); 369 381 // get normal vector 370 382 NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node); … … 373 385 if (NormalVector.ScalarProduct(&OtherVector) > 0.) 374 386 NormalVector.Scale(-1.); 387 Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl; 375 388 }; 376 389 … … 389 402 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection) 390 403 { 404 Info FunctionInfo(__func__); 391 405 Vector CrossPoint; 392 406 Vector helper; 393 407 394 408 if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) { 395 Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;409 eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl; 396 410 return false; 397 411 } … … 409 423 } while (CrossPoint.NormSquared() < MYEPSILON); 410 424 if (i==3) { 411 Log() << Verbose(1) << "ERROR: Could not find any cross points, something's utterly wrong here!" << endl; 412 exit(255); 425 eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl; 413 426 } 414 427 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 429 442 bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line) 430 443 { 444 Info FunctionInfo(__func__); 431 445 for(int i=0;i<3;i++) 432 446 if (line == lines[i]) … … 441 455 bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 442 456 { 457 Info FunctionInfo(__func__); 443 458 for(int i=0;i<3;i++) 444 459 if (point == endpoints[i]) … … 453 468 bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point) 454 469 { 470 Info FunctionInfo(__func__); 455 471 for(int i=0;i<3;i++) 456 472 if (point == endpoints[i]->node) … … 465 481 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3]) 466 482 { 483 Info FunctionInfo(__func__); 467 484 return (((endpoints[0] == Points[0]) 468 485 || (endpoints[0] == Points[1]) … … 486 503 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T) 487 504 { 505 Info FunctionInfo(__func__); 488 506 return (((endpoints[0] == T->endpoints[0]) 489 507 || (endpoints[0] == T->endpoints[1]) … … 507 525 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line) 508 526 { 527 Info FunctionInfo(__func__); 509 528 // sanity check 510 529 if (!ContainsBoundaryLine(line)) … … 523 542 void BoundaryTriangleSet::GetCenter(Vector *center) 524 543 { 544 Info FunctionInfo(__func__); 525 545 center->Zero(); 526 546 for(int i=0;i<3;i++) … … 535 555 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a) 536 556 { 537 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 538 << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]"; 557 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << "," << a.endpoints[1]->node->Name << "," << a.endpoints[2]->node->Name << "]"; 558 // ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 559 // << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]"; 539 560 return ost; 540 561 }; … … 546 567 TesselPoint::TesselPoint() 547 568 { 569 Info FunctionInfo(__func__); 548 570 node = NULL; 549 571 nr = -1; … … 555 577 TesselPoint::~TesselPoint() 556 578 { 579 Info FunctionInfo(__func__); 557 580 }; 558 581 … … 569 592 ostream & TesselPoint::operator << (ostream &ost) 570 593 { 571 ost << "[" << (Name) << "|" << this << "]"; 594 Info FunctionInfo(__func__); 595 ost << "[" << (nr) << "|" << this << "]"; 572 596 return ost; 573 597 }; … … 580 604 PointCloud::PointCloud() 581 605 { 582 606 Info FunctionInfo(__func__); 583 607 }; 584 608 … … 587 611 PointCloud::~PointCloud() 588 612 { 589 613 Info FunctionInfo(__func__); 590 614 }; 591 615 … … 594 618 /** Constructor of class CandidateForTesselation. 595 619 */ 596 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) { 597 point = candidate; 598 BaseLine = line; 620 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 621 BaseLine(line), 622 ShortestAngle(2.*M_PI), 623 OtherShortestAngle(2.*M_PI) 624 { 625 Info FunctionInfo(__func__); 626 }; 627 628 629 /** Constructor of class CandidateForTesselation. 630 */ 631 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 632 BaseLine(line), 633 ShortestAngle(2.*M_PI), 634 OtherShortestAngle(2.*M_PI) 635 { 636 Info FunctionInfo(__func__); 599 637 OptCenter.CopyVector(&OptCandidateCenter); 600 638 OtherOptCenter.CopyVector(&OtherOptCandidateCenter); … … 604 642 */ 605 643 CandidateForTesselation::~CandidateForTesselation() { 606 point = NULL;607 644 BaseLine = NULL; 608 645 }; 609 646 647 /** output operator for CandidateForTesselation. 648 * \param &ost output stream 649 * \param &a boundary line 650 */ 651 ostream & operator <<(ostream &ost, const CandidateForTesselation &a) 652 { 653 ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with "; 654 if (a.pointlist.empty()) 655 ost << "no candidate."; 656 else { 657 ost << "candidate"; 658 if (a.pointlist.size() != 1) 659 ost << "s "; 660 else 661 ost << " "; 662 for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++) 663 ost << *(*Runner) << " "; 664 ost << " at angle " << (a.ShortestAngle)<< "."; 665 } 666 667 return ost; 668 }; 669 670 610 671 // =========================================================== class TESSELATION =========================================== 611 672 612 673 /** Constructor of class Tesselation. 613 674 */ 614 Tesselation::Tesselation() 615 { 616 PointsOnBoundaryCount = 0; 617 LinesOnBoundaryCount = 0; 618 TrianglesOnBoundaryCount = 0; 619 InternalPointer = PointsOnBoundary.begin(); 620 LastTriangle = NULL; 621 TriangleFilesWritten = 0; 675 Tesselation::Tesselation() : 676 PointsOnBoundaryCount(0), 677 LinesOnBoundaryCount(0), 678 TrianglesOnBoundaryCount(0), 679 LastTriangle(NULL), 680 TriangleFilesWritten(0), 681 InternalPointer(PointsOnBoundary.begin()) 682 { 683 Info FunctionInfo(__func__); 622 684 } 623 685 ; … … 628 690 Tesselation::~Tesselation() 629 691 { 630 Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl; 692 Info FunctionInfo(__func__); 693 Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl; 631 694 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 632 695 if (runner->second != NULL) { … … 634 697 runner->second = NULL; 635 698 } else 636 eLog() << Verbose(1) << " ERROR:The triangle " << runner->first << " has already been free'd." << endl;637 } 638 Log() << Verbose( 1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;699 eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl; 700 } 701 Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl; 639 702 } 640 703 ; … … 645 708 Vector * Tesselation::GetCenter(ofstream *out) const 646 709 { 710 Info FunctionInfo(__func__); 647 711 Vector *Center = new Vector(0.,0.,0.); 648 712 int num=0; … … 660 724 TesselPoint * Tesselation::GetPoint() const 661 725 { 726 Info FunctionInfo(__func__); 662 727 return (InternalPointer->second->node); 663 728 }; … … 668 733 TesselPoint * Tesselation::GetTerminalPoint() const 669 734 { 735 Info FunctionInfo(__func__); 670 736 PointMap::const_iterator Runner = PointsOnBoundary.end(); 671 737 Runner--; … … 678 744 void Tesselation::GoToNext() const 679 745 { 746 Info FunctionInfo(__func__); 680 747 if (InternalPointer != PointsOnBoundary.end()) 681 748 InternalPointer++; … … 687 754 void Tesselation::GoToPrevious() const 688 755 { 756 Info FunctionInfo(__func__); 689 757 if (InternalPointer != PointsOnBoundary.begin()) 690 758 InternalPointer--; … … 696 764 void Tesselation::GoToFirst() const 697 765 { 766 Info FunctionInfo(__func__); 698 767 InternalPointer = PointsOnBoundary.begin(); 699 768 }; … … 704 773 void Tesselation::GoToLast() const 705 774 { 775 Info FunctionInfo(__func__); 706 776 InternalPointer = PointsOnBoundary.end(); 707 777 InternalPointer--; … … 713 783 bool Tesselation::IsEmpty() const 714 784 { 785 Info FunctionInfo(__func__); 715 786 return (PointsOnBoundary.empty()); 716 787 }; … … 721 792 bool Tesselation::IsEnd() const 722 793 { 794 Info FunctionInfo(__func__); 723 795 return (InternalPointer == PointsOnBoundary.end()); 724 796 }; … … 733 805 Tesselation::GuessStartingTriangle() 734 806 { 807 Info FunctionInfo(__func__); 735 808 // 4b. create a starting triangle 736 809 // 4b1. create all distances … … 779 852 baseline->second.first->second->node->node, 780 853 baseline->second.second->second->node->node); 781 Log() << Verbose(2) << "Plane vector of candidate triangle is "; 782 PlaneVector.Output(); 783 Log() << Verbose(0) << endl; 854 Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl; 784 855 // 4. loop over all points 785 856 double sign = 0.; … … 797 868 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 798 869 continue; 799 Log() << Verbose(3) << "Projection of " << checker->second->node->Name 800 << " yields distance of " << distance << "." << endl; 870 Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl; 801 871 tmp = distance / fabs(distance); 802 872 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) … … 851 921 if (checker == PointsOnBoundary.end()) 852 922 { 853 Log() << Verbose( 0) << "Looks like we have a candidate!" << endl;923 Log() << Verbose(2) << "Looks like we have a candidate!" << endl; 854 924 break; 855 925 } … … 881 951 else 882 952 { 883 Log() << Verbose(1) << "No starting triangle found." << endl; 884 exit(255); 953 eLog() << Verbose(0) << "No starting triangle found." << endl; 885 954 } 886 955 } … … 902 971 void Tesselation::TesselateOnBoundary(const PointCloud * const cloud) 903 972 { 973 Info FunctionInfo(__func__); 904 974 bool flag; 905 975 PointMap::iterator winner; … … 920 990 // get peak point with respect to this base line's only triangle 921 991 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 922 Log() << Verbose( 2) << "Current baseline is between " << *(baseline->second) << "." << endl;992 Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl; 923 993 for (int i = 0; i < 3; i++) 924 994 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 925 995 peak = BTS->endpoints[i]; 926 Log() << Verbose( 3) << " and has peak " << *peak << "." << endl;996 Log() << Verbose(1) << " and has peak " << *peak << "." << endl; 927 997 928 998 // prepare some auxiliary vectors … … 939 1009 CenterVector.AddVector(BTS->endpoints[i]->node->node); 940 1010 CenterVector.Scale(1. / 3.); 941 Log() << Verbose( 4) << "CenterVector of base triangle is " << CenterVector << endl;1011 Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl; 942 1012 943 1013 // normal vector of triangle … … 946 1016 BTS->GetNormalVector(NormalVector); 947 1017 NormalVector.CopyVector(&BTS->NormalVector); 948 Log() << Verbose( 4) << "NormalVector of base triangle is " << NormalVector << endl;1018 Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl; 949 1019 950 1020 // vector in propagation direction (out of triangle) … … 953 1023 TempVector.CopyVector(&CenterVector); 954 1024 TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 955 //Log() << Verbose( 2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;1025 //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl; 956 1026 if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline 957 1027 PropagationVector.Scale(-1.); 958 Log() << Verbose( 4) << "PropagationVector of base triangle is " << PropagationVector << endl;1028 Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl; 959 1029 winner = PointsOnBoundary.end(); 960 1030 … … 962 1032 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 963 1033 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 964 Log() << Verbose( 3) << "Target point is " << *(target->second) << ":" << endl;1034 Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl; 965 1035 966 1036 // first check direction, so that triangles don't intersect … … 969 1039 VirtualNormalVector.ProjectOntoPlane(&NormalVector); 970 1040 TempAngle = VirtualNormalVector.Angle(&PropagationVector); 971 Log() << Verbose( 4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;1041 Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl; 972 1042 if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees) 973 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;1043 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl; 974 1044 continue; 975 1045 } else 976 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;1046 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl; 977 1047 978 1048 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 980 1050 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 981 1051 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 982 Log() << Verbose( 4) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;1052 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; 983 1053 continue; 984 1054 } 985 1055 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 986 Log() << Verbose( 4) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;1056 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; 987 1057 continue; 988 1058 } … … 1001 1071 helper.ProjectOntoPlane(&TempVector); 1002 1072 if (fabs(helper.NormSquared()) < MYEPSILON) { 1003 Log() << Verbose( 4) << "Chosen set of vectors is linear dependent." << endl;1073 Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl; 1004 1074 continue; 1005 1075 } … … 1018 1088 // calculate angle 1019 1089 TempAngle = NormalVector.Angle(&VirtualNormalVector); 1020 Log() << Verbose( 4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;1090 Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl; 1021 1091 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 1022 1092 SmallestAngle = TempAngle; 1023 1093 winner = target; 1024 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1094 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1025 1095 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 1026 1096 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 1040 1110 SmallestAngle = TempAngle; 1041 1111 winner = target; 1042 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;1112 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl; 1043 1113 } else 1044 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;1114 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl; 1045 1115 } else 1046 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1116 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1047 1117 } 1048 1118 } // end of loop over all boundary points … … 1050 1120 // 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 1051 1121 if (winner != PointsOnBoundary.end()) { 1052 Log() << Verbose( 2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;1122 Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl; 1053 1123 // create the lins of not yet present 1054 1124 BLS[0] = baseline->second; … … 1080 1150 TrianglesOnBoundaryCount++; 1081 1151 } else { 1082 Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;1152 eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl; 1083 1153 } 1084 1154 1085 1155 // 5d. If the set of lines is not yet empty, go to 5. and continue 1086 1156 } else 1087 Log() << Verbose( 2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;1157 Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl; 1088 1158 } while (flag); 1089 1159 … … 1100 1170 bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC) 1101 1171 { 1172 Info FunctionInfo(__func__); 1102 1173 Vector Intersection, Normal; 1103 1174 TesselPoint *Walker = NULL; … … 1106 1177 bool AddFlag = false; 1107 1178 LinkedCell *BoundaryPoints = NULL; 1108 1109 Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;1110 1179 1111 1180 cloud->GoToFirst(); … … 1118 1187 } 1119 1188 Walker = cloud->GetPoint(); 1120 Log() << Verbose( 2) << "Current point is " << *Walker << "." << endl;1189 Log() << Verbose(0) << "Current point is " << *Walker << "." << endl; 1121 1190 // get the next triangle 1122 1191 triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints); 1123 1192 BTS = triangles->front(); 1124 1193 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1125 Log() << Verbose( 2) << "No triangles found, probably a tesselation point itself." << endl;1194 Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl; 1126 1195 cloud->GoToNext(); 1127 1196 continue; 1128 1197 } else { 1129 1198 } 1130 Log() << Verbose( 2) << "Closest triangle is " << *BTS << "." << endl;1199 Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl; 1131 1200 // get the intersection point 1132 1201 if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) { 1133 Log() << Verbose( 2) << "We have an intersection at " << Intersection << "." << endl;1202 Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl; 1134 1203 // we have the intersection, check whether in- or outside of boundary 1135 1204 if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) { 1136 1205 // inside, next! 1137 Log() << Verbose( 2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;1206 Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl; 1138 1207 } else { 1139 1208 // outside! 1140 Log() << Verbose( 2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;1209 Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl; 1141 1210 class BoundaryLineSet *OldLines[3], *NewLines[3]; 1142 1211 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 1148 1217 Normal.CopyVector(&BTS->NormalVector); 1149 1218 // add Walker to boundary points 1150 Log() << Verbose( 2) << "Adding " << *Walker << " to BoundaryPoints." << endl;1219 Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl; 1151 1220 AddFlag = true; 1152 1221 if (AddBoundaryPoint(Walker,0)) … … 1155 1224 continue; 1156 1225 // remove triangle 1157 Log() << Verbose( 2) << "Erasing triangle " << *BTS << "." << endl;1226 Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl; 1158 1227 TrianglesOnBoundary.erase(BTS->Nr); 1159 1228 delete(BTS); … … 1163 1232 BPS[1] = OldPoints[i]; 1164 1233 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 1165 Log() << Verbose( 3) << "Creating new line " << *NewLines[i] << "." << endl;1234 Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl; 1166 1235 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 1167 1236 LinesOnBoundaryCount++; … … 1174 1243 if (NewLines[j]->IsConnectedTo(BLS[0])) { 1175 1244 if (n>2) { 1176 Log() << Verbose(1) << "ERROR: "<< BLS[0] << " connects to all of the new lines?!" << endl;1245 eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl; 1177 1246 return false; 1178 1247 } else … … 1185 1254 BTS->GetNormalVector(Normal); 1186 1255 Normal.Scale(-1.); 1187 Log() << Verbose( 2) << "Created new triangle " << *BTS << "." << endl;1256 Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl; 1188 1257 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1189 1258 TrianglesOnBoundaryCount++; … … 1191 1260 } 1192 1261 } else { // something is wrong with FindClosestTriangleToPoint! 1193 Log() << Verbose(1) << "ERROR:The closest triangle did not produce an intersection!" << endl;1262 eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl; 1194 1263 return false; 1195 1264 } … … 1199 1268 // exit 1200 1269 delete(Center); 1201 Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;1202 1270 return true; 1203 1271 }; … … 1210 1278 bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n) 1211 1279 { 1280 Info FunctionInfo(__func__); 1212 1281 PointTestPair InsertUnique; 1213 1282 BPS[n] = new class BoundaryPointSet(Walker); … … 1231 1300 void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n) 1232 1301 { 1302 Info FunctionInfo(__func__); 1233 1303 PointTestPair InsertUnique; 1234 1304 TPS[n] = new class BoundaryPointSet(Candidate); … … 1238 1308 } else { 1239 1309 delete TPS[n]; 1240 Log() << Verbose( 4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;1310 Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl; 1241 1311 TPS[n] = (InsertUnique.first)->second; 1242 1312 } 1243 1313 } 1244 1314 ; 1315 1316 /** Sets point to a present Tesselation::PointsOnBoundary. 1317 * Tesselation::TPS is set to the existing one or NULL if not found. 1318 * @param Candidate point to set to 1319 * @param n index for this point in Tesselation::TPS array 1320 */ 1321 void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const 1322 { 1323 Info FunctionInfo(__func__); 1324 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr); 1325 if (FindPoint != PointsOnBoundary.end()) 1326 TPS[n] = FindPoint->second; 1327 else 1328 TPS[n] = NULL; 1329 }; 1245 1330 1246 1331 /** Function tries to add line from current Points in BPS to BoundaryLineSet. … … 1258 1343 pair<LineMap::iterator,LineMap::iterator> FindPair; 1259 1344 FindPair = a->lines.equal_range(b->node->nr); 1260 Log() << Verbose( 5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;1345 Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl; 1261 1346 1262 1347 for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { … … 1264 1349 if (FindLine->second->triangles.size() < 2) { 1265 1350 insertNewLine = false; 1266 Log() << Verbose( 4) << "Using existing line " << *FindLine->second << endl;1351 Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl; 1267 1352 1268 1353 BPS[0] = FindLine->second->endpoints[0]; 1269 1354 BPS[1] = FindLine->second->endpoints[1]; 1270 1355 BLS[n] = FindLine->second; 1356 1357 // remove existing line from OpenLines 1358 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 1359 delete(CandidateLine->second); 1360 OpenLines.erase(CandidateLine); 1271 1361 1272 1362 break; … … 1291 1381 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n) 1292 1382 { 1293 Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1383 Info FunctionInfo(__func__); 1384 Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1294 1385 BPS[0] = a; 1295 1386 BPS[1] = b; … … 1299 1390 // increase counter 1300 1391 LinesOnBoundaryCount++; 1392 // also add to open lines 1393 CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]); 1394 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT)); 1301 1395 }; 1302 1396 … … 1306 1400 void Tesselation::AddTesselationTriangle() 1307 1401 { 1402 Info FunctionInfo(__func__); 1308 1403 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1309 1404 … … 1324 1419 void Tesselation::AddTesselationTriangle(const int nr) 1325 1420 { 1326 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1421 Info FunctionInfo(__func__); 1422 Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1327 1423 1328 1424 // add triangle to global map … … 1342 1438 void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle) 1343 1439 { 1440 Info FunctionInfo(__func__); 1344 1441 if (triangle == NULL) 1345 1442 return; 1346 1443 for (int i = 0; i < 3; i++) { 1347 1444 if (triangle->lines[i] != NULL) { 1348 Log() << Verbose( 5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;1445 Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl; 1349 1446 triangle->lines[i]->triangles.erase(triangle->Nr); 1350 1447 if (triangle->lines[i]->triangles.empty()) { 1351 Log() << Verbose( 5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;1448 Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl; 1352 1449 RemoveTesselationLine(triangle->lines[i]); 1353 1450 } else { 1354 Log() << Verbose( 5) << *triangle->lines[i] << " is still attached to another triangle: ";1451 Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: "; 1355 1452 for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 1356 1453 Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 1357 1454 Log() << Verbose(0) << endl; 1358 1455 // for (int j=0;j<2;j++) { 1359 // Log() << Verbose( 5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";1456 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 1360 1457 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 1361 1458 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1365 1462 triangle->lines[i] = NULL; // free'd or not: disconnect 1366 1463 } else 1367 eLog() << Verbose( 0) << "ERROR:This line " << i << " has already been free'd." << endl;1464 eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl; 1368 1465 } 1369 1466 1370 1467 if (TrianglesOnBoundary.erase(triangle->Nr)) 1371 Log() << Verbose( 5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;1468 Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl; 1372 1469 delete(triangle); 1373 1470 }; … … 1379 1476 void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line) 1380 1477 { 1478 Info FunctionInfo(__func__); 1381 1479 int Numbers[2]; 1382 1480 … … 1399 1497 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 1400 1498 if ((*Runner).second == line) { 1401 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1499 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1402 1500 line->endpoints[i]->lines.erase(Runner); 1403 1501 break; … … 1405 1503 } else { // there's just a single line left 1406 1504 if (line->endpoints[i]->lines.erase(line->Nr)) 1407 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1505 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1408 1506 } 1409 1507 if (line->endpoints[i]->lines.empty()) { 1410 Log() << Verbose( 5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;1508 Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl; 1411 1509 RemoveTesselationPoint(line->endpoints[i]); 1412 1510 } else { 1413 Log() << Verbose( 5) << *line->endpoints[i] << " has still lines it's attached to: ";1511 Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "; 1414 1512 for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 1415 1513 Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1418 1516 line->endpoints[i] = NULL; // free'd or not: disconnect 1419 1517 } else 1420 eLog() << Verbose( 0) << "ERROR:Endpoint " << i << " has already been free'd." << endl;1518 eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl; 1421 1519 } 1422 1520 if (!line->triangles.empty()) 1423 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *line << " am still connected to some triangles." << endl;1521 eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl; 1424 1522 1425 1523 if (LinesOnBoundary.erase(line->Nr)) 1426 Log() << Verbose( 5) << "Removing line Nr. " << line->Nr << "." << endl;1524 Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl; 1427 1525 delete(line); 1428 1526 }; … … 1435 1533 void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point) 1436 1534 { 1535 Info FunctionInfo(__func__); 1437 1536 if (point == NULL) 1438 1537 return; 1439 1538 if (PointsOnBoundary.erase(point->Nr)) 1440 Log() << Verbose( 5) << "Removing point Nr. " << point->Nr << "." << endl;1539 Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl; 1441 1540 delete(point); 1442 1541 }; … … 1451 1550 * triangles exist which is the maximum for three points 1452 1551 */ 1453 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) { 1552 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const 1553 { 1554 Info FunctionInfo(__func__); 1454 1555 int adjacentTriangleCount = 0; 1455 1556 class BoundaryPointSet *Points[3]; 1456 1557 1457 Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;1458 1558 // builds a triangle point set (Points) of the end points 1459 1559 for (int i = 0; i < 3; i++) { 1460 PointMap:: iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);1560 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr); 1461 1561 if (FindPoint != PointsOnBoundary.end()) { 1462 1562 Points[i] = FindPoint->second; … … 1471 1571 for (int j = i; j < 3; j++) { 1472 1572 if (Points[j] != NULL) { 1473 LineMap:: iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);1573 LineMap::const_iterator FindLine = Points[i]->lines.find(Points[j]->node->nr); 1474 1574 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) { 1475 1575 TriangleMap *triangles = &FindLine->second->triangles; 1476 Log() << Verbose( 3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;1477 for (TriangleMap:: iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {1576 Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl; 1577 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 1478 1578 if (FindTriangle->second->IsPresentTupel(Points)) { 1479 1579 adjacentTriangleCount++; 1480 1580 } 1481 1581 } 1482 Log() << Verbose( 3) << "end." << endl;1582 Log() << Verbose(1) << "end." << endl; 1483 1583 } 1484 1584 // Only one of the triangle lines must be considered for the triangle count. 1485 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1585 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1486 1586 //return adjacentTriangleCount; 1487 1587 } … … 1490 1590 } 1491 1591 1492 Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1493 Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl; 1592 Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1494 1593 return adjacentTriangleCount; 1495 1594 }; … … 1505 1604 class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3]) 1506 1605 { 1606 Info FunctionInfo(__func__); 1507 1607 class BoundaryTriangleSet *triangle = NULL; 1508 1608 class BoundaryPointSet *Points[3]; … … 1534 1634 } 1535 1635 // Only one of the triangle lines must be considered for the triangle count. 1536 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1636 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1537 1637 //return adjacentTriangleCount; 1538 1638 } … … 1555 1655 void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC) 1556 1656 { 1557 Log() << Verbose(1) << "Begin of FindStartingTriangle\n";1657 Info FunctionInfo(__func__); 1558 1658 int i = 0; 1559 TesselPoint* FirstPoint = NULL;1560 TesselPoint* SecondPoint = NULL;1561 1659 TesselPoint* MaxPoint[NDIM]; 1660 TesselPoint* Temporary; 1562 1661 double maxCoordinate[NDIM]; 1662 BoundaryLineSet BaseLine; 1563 1663 Vector Oben; 1564 1664 Vector helper; … … 1579 1679 for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) { 1580 1680 const LinkedNodes *List = LC->GetCurrentCell(); 1581 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1681 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1582 1682 if (List != NULL) { 1583 1683 for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) { 1584 1684 if ((*Runner)->node->x[i] > maxCoordinate[i]) { 1585 Log() << Verbose( 2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;1685 Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl; 1586 1686 maxCoordinate[i] = (*Runner)->node->x[i]; 1587 1687 MaxPoint[i] = (*Runner); … … 1589 1689 } 1590 1690 } else { 1591 eLog() << Verbose( 0) << "ERROR:The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;1691 eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl; 1592 1692 } 1593 1693 } 1594 1694 } 1595 1695 1596 Log() << Verbose( 2) << "Found maximum coordinates: ";1696 Log() << Verbose(1) << "Found maximum coordinates: "; 1597 1697 for (int i=0;i<NDIM;i++) 1598 1698 Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"; … … 1600 1700 1601 1701 BTS = NULL; 1602 CandidateList *OptCandidates = new CandidateList();1603 1702 for (int k=0;k<NDIM;k++) { 1604 1703 Oben.Zero(); 1605 1704 Oben.x[k] = 1.; 1606 FirstPoint = MaxPoint[k];1607 Log() << Verbose( 1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;1705 BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 1706 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 1608 1707 1609 1708 double ShortestAngle; 1610 TesselPoint* OptCandidate = NULL;1611 1709 ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1612 1710 1613 FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1614 SecondPoint = OptCandidate; 1615 if (SecondPoint == NULL) // have we found a second point? 1711 FindSecondPointForTesselation(BaseLine.endpoints[0]->node, Oben, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1712 if (Temporary == NULL) // have we found a second point? 1616 1713 continue; 1617 1618 helper.CopyVector(FirstPoint->node); 1619 helper.SubtractVector(SecondPoint->node); 1714 BaseLine.endpoints[1] = new BoundaryPointSet(Temporary); 1715 1716 helper.CopyVector(BaseLine.endpoints[0]->node->node); 1717 helper.SubtractVector(BaseLine.endpoints[1]->node->node); 1620 1718 helper.Normalize(); 1621 1719 Oben.ProjectOntoPlane(&helper); … … 1624 1722 ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1625 1723 1626 Chord.CopyVector( FirstPoint->node); // bring into calling function1627 Chord.SubtractVector( SecondPoint->node);1724 Chord.CopyVector(BaseLine.endpoints[0]->node->node); // bring into calling function 1725 Chord.SubtractVector(BaseLine.endpoints[1]->node->node); 1628 1726 double radius = Chord.ScalarProduct(&Chord); 1629 1727 double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.); … … 1636 1734 1637 1735 // adding point 1 and point 2 and add the line between them 1638 Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl; 1639 AddTesselationPoint(FirstPoint, 0); 1640 Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n"; 1641 AddTesselationPoint(SecondPoint, 1); 1642 AddTesselationLine(TPS[0], TPS[1], 0); 1643 1644 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1645 FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC); 1646 Log() << Verbose(1) << "List of third Points is "; 1647 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1648 Log() << Verbose(0) << " " << *(*it)->point; 1649 } 1650 Log() << Verbose(0) << endl; 1651 1652 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1653 // add third triangle point 1654 AddTesselationPoint((*it)->point, 2); 1655 // add the second and third line 1656 AddTesselationLine(TPS[1], TPS[2], 1); 1657 AddTesselationLine(TPS[0], TPS[2], 2); 1658 // ... and triangles to the Maps of the Tesselation class 1659 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1660 AddTesselationTriangle(); 1661 // ... and calculate its normal vector (with correct orientation) 1662 (*it)->OptCenter.Scale(-1.); 1663 Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl; 1664 BTS->GetNormalVector((*it)->OptCenter); // vector to compare with should point inwards 1665 Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " 1666 << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n"; 1667 1668 // if we do not reach the end with the next step of iteration, we need to setup a new first line 1669 if (it != OptCandidates->end()--) { 1670 FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1671 SecondPoint = (*it)->point; 1672 // adding point 1 and point 2 and the line between them 1673 AddTesselationPoint(FirstPoint, 0); 1674 AddTesselationPoint(SecondPoint, 1); 1675 AddTesselationLine(TPS[0], TPS[1], 0); 1676 } 1677 Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl; 1678 } 1736 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 1737 Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n"; 1738 1739 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1740 CandidateForTesselation OptCandidates(&BaseLine); 1741 FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC); 1742 Log() << Verbose(0) << "List of third Points is:" << endl; 1743 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 1744 Log() << Verbose(0) << " " << *(*it) << endl; 1745 } 1746 1747 BTS = NULL; 1748 AddCandidateTriangle(OptCandidates); 1749 // delete(BaseLine.endpoints[0]); 1750 // delete(BaseLine.endpoints[1]); 1751 1679 1752 if (BTS != NULL) // we have created one starting triangle 1680 1753 break; 1681 1754 else { 1682 1755 // remove all candidates from the list and then the list itself 1683 class CandidateForTesselation *remover = NULL; 1684 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1685 remover = *it; 1686 delete(remover); 1687 } 1688 OptCandidates->clear(); 1689 } 1690 } 1691 1692 // remove all candidates from the list and then the list itself 1693 class CandidateForTesselation *remover = NULL; 1694 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1695 remover = *it; 1696 delete(remover); 1697 } 1698 delete(OptCandidates); 1699 Log() << Verbose(1) << "End of FindStartingTriangle\n"; 1700 }; 1701 1756 OptCandidates.pointlist.clear(); 1757 } 1758 } 1759 }; 1760 1761 /** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates. 1762 * This is supposed to prevent early closing of the tesselation. 1763 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate 1764 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints 1765 * \param RADIUS radius of sphere 1766 * \param *LC LinkedCell structure 1767 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found 1768 */ 1769 //bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const 1770 //{ 1771 // Info FunctionInfo(__func__); 1772 // bool result = false; 1773 // Vector CircleCenter; 1774 // Vector CirclePlaneNormal; 1775 // Vector OldSphereCenter; 1776 // Vector SearchDirection; 1777 // Vector helper; 1778 // TesselPoint *OtherOptCandidate = NULL; 1779 // double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1780 // double radius, CircleRadius; 1781 // BoundaryLineSet *Line = NULL; 1782 // BoundaryTriangleSet *T = NULL; 1783 // 1784 // // check both other lines 1785 // PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 1786 // if (FindPoint != PointsOnBoundary.end()) { 1787 // for (int i=0;i<2;i++) { 1788 // LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 1789 // if (FindLine != (FindPoint->second)->lines.end()) { 1790 // Line = FindLine->second; 1791 // Log() << Verbose(0) << "Found line " << *Line << "." << endl; 1792 // if (Line->triangles.size() == 1) { 1793 // T = Line->triangles.begin()->second; 1794 // // construct center of circle 1795 // CircleCenter.CopyVector(Line->endpoints[0]->node->node); 1796 // CircleCenter.AddVector(Line->endpoints[1]->node->node); 1797 // CircleCenter.Scale(0.5); 1798 // 1799 // // construct normal vector of circle 1800 // CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 1801 // CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 1802 // 1803 // // calculate squared radius of circle 1804 // radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 1805 // if (radius/4. < RADIUS*RADIUS) { 1806 // CircleRadius = RADIUS*RADIUS - radius/4.; 1807 // CirclePlaneNormal.Normalize(); 1808 // //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1809 // 1810 // // construct old center 1811 // GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 1812 // helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 1813 // radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1814 // helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1815 // OldSphereCenter.AddVector(&helper); 1816 // OldSphereCenter.SubtractVector(&CircleCenter); 1817 // //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1818 // 1819 // // construct SearchDirection 1820 // SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 1821 // helper.CopyVector(Line->endpoints[0]->node->node); 1822 // helper.SubtractVector(ThirdNode->node); 1823 // if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1824 // SearchDirection.Scale(-1.); 1825 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1826 // SearchDirection.Normalize(); 1827 // Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1828 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1829 // // rotated the wrong way! 1830 // eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1831 // } 1832 // 1833 // // add third point 1834 // FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC); 1835 // for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) { 1836 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1837 // continue; 1838 // Log() << Verbose(0) << " Third point candidate is " << (*it) 1839 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1840 // Log() << Verbose(0) << " Baseline is " << *BaseRay << endl; 1841 // 1842 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1843 // TesselPoint *PointCandidates[3]; 1844 // PointCandidates[0] = (*it); 1845 // PointCandidates[1] = BaseRay->endpoints[0]->node; 1846 // PointCandidates[2] = BaseRay->endpoints[1]->node; 1847 // bool check=false; 1848 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1849 // // If there is no triangle, add it regularly. 1850 // if (existentTrianglesCount == 0) { 1851 // SetTesselationPoint((*it), 0); 1852 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1853 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1854 // 1855 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1856 // OtherOptCandidate = (*it); 1857 // check = true; 1858 // } 1859 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1860 // SetTesselationPoint((*it), 0); 1861 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1862 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1863 // 1864 // // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 1865 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 1866 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1867 // OtherOptCandidate = (*it); 1868 // check = true; 1869 // } 1870 // } 1871 // 1872 // if (check) { 1873 // if (ShortestAngle > OtherShortestAngle) { 1874 // Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 1875 // result = true; 1876 // break; 1877 // } 1878 // } 1879 // } 1880 // delete(OptCandidates); 1881 // if (result) 1882 // break; 1883 // } else { 1884 // Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 1885 // } 1886 // } else { 1887 // eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 1888 // } 1889 // } else { 1890 // Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 1891 // } 1892 // } 1893 // } else { 1894 // eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 1895 // } 1896 // 1897 // return result; 1898 //}; 1702 1899 1703 1900 /** This function finds a triangle to a line, adjacent to an existing one. 1704 1901 * @param out output stream for debugging 1705 * @param Line currentbaseline to search from1902 * @param CandidateLine current cadndiate baseline to search from 1706 1903 * @param T current triangle which \a Line is edge of 1707 1904 * @param RADIUS radius of the rolling ball … … 1709 1906 * @param *LC LinkedCell structure with neighbouring points 1710 1907 */ 1711 bool Tesselation::FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)1712 { 1713 Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";1908 bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC) 1909 { 1910 Info FunctionInfo(__func__); 1714 1911 bool result = true; 1715 CandidateList *OptCandidates = new CandidateList();1716 1912 1717 1913 Vector CircleCenter; … … 1722 1918 TesselPoint *ThirdNode = NULL; 1723 1919 LineMap::iterator testline; 1724 double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.1725 1920 double radius, CircleRadius; 1726 1921 1727 Log() << Verbose( 1) << "Current baseline is " <<Line << " of triangle " << T << "." << endl;1922 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl; 1728 1923 for (int i=0;i<3;i++) 1729 if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))1924 if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) 1730 1925 ThirdNode = T.endpoints[i]->node; 1731 1926 1732 1927 // construct center of circle 1733 CircleCenter.CopyVector( Line.endpoints[0]->node->node);1734 CircleCenter.AddVector( Line.endpoints[1]->node->node);1928 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1929 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1735 1930 CircleCenter.Scale(0.5); 1736 1931 1737 1932 // construct normal vector of circle 1738 CirclePlaneNormal.CopyVector( Line.endpoints[0]->node->node);1739 CirclePlaneNormal.SubtractVector( Line.endpoints[1]->node->node);1933 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1934 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1740 1935 1741 1936 // calculate squared radius of circle … … 1744 1939 CircleRadius = RADIUS*RADIUS - radius/4.; 1745 1940 CirclePlaneNormal.Normalize(); 1746 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;1941 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1747 1942 1748 1943 // construct old center 1749 1944 GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node); 1750 1945 helper.CopyVector(&T.NormalVector); // normal vector ensures that this is correct center of the two possible ones 1751 radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);1946 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1752 1947 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1753 1948 OldSphereCenter.AddVector(&helper); 1754 1949 OldSphereCenter.SubtractVector(&CircleCenter); 1755 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;1950 Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1756 1951 1757 1952 // construct SearchDirection 1758 1953 SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal); 1759 helper.CopyVector( Line.endpoints[0]->node->node);1954 helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1760 1955 helper.SubtractVector(ThirdNode->node); 1761 1956 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! … … 1763 1958 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1764 1959 SearchDirection.Normalize(); 1765 Log() << Verbose( 2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;1960 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1766 1961 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1767 1962 // rotated the wrong way! 1768 eLog() << Verbose( 0) << "ERROR:SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;1963 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1769 1964 } 1770 1965 1771 1966 // add third point 1772 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);1967 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine, ThirdNode, RADIUS, LC); 1773 1968 1774 1969 } else { 1775 Log() << Verbose( 1) << "Circumcircle for base line " <<Line << " and base triangle " << T << " is too big!" << endl;1776 } 1777 1778 if ( OptCandidates->begin() == OptCandidates->end()) {1779 eLog() << Verbose( 0) << "WARNING:Could not find a suitable candidate." << endl;1970 Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl; 1971 } 1972 1973 if (CandidateLine.pointlist.empty()) { 1974 eLog() << Verbose(2) << "Could not find a suitable candidate." << endl; 1780 1975 return false; 1781 1976 } 1782 Log() << Verbose(1) << "Third Points are "; 1783 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1784 Log() << Verbose(0) << " " << *(*it)->point; 1785 } 1786 Log() << Verbose(0) << endl; 1787 1788 BoundaryLineSet *BaseRay = &Line; 1789 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1790 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1791 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1792 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1793 1794 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1795 TesselPoint *PointCandidates[3]; 1796 PointCandidates[0] = (*it)->point; 1797 PointCandidates[1] = BaseRay->endpoints[0]->node; 1798 PointCandidates[2] = BaseRay->endpoints[1]->node; 1799 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1800 1801 BTS = NULL; 1802 // If there is no triangle, add it regularly. 1803 if (existentTrianglesCount == 0) { 1804 AddTesselationPoint((*it)->point, 0); 1805 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1806 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1807 1808 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1809 AddTesselationLine(TPS[0], TPS[1], 0); 1810 AddTesselationLine(TPS[0], TPS[2], 1); 1811 AddTesselationLine(TPS[1], TPS[2], 2); 1812 1813 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1814 AddTesselationTriangle(); 1815 (*it)->OptCenter.Scale(-1.); 1816 BTS->GetNormalVector((*it)->OptCenter); 1817 (*it)->OptCenter.Scale(-1.); 1818 1819 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1820 << " for this triangle ... " << endl; 1821 //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl; 1822 } else { 1823 Log() << Verbose(1) << "WARNING: This triangle consisting of "; 1824 Log() << Verbose(0) << *(*it)->point << ", "; 1825 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1826 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1827 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1828 result = false; 1829 } 1830 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1831 AddTesselationPoint((*it)->point, 0); 1832 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1833 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1834 1835 // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 1836 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1837 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1838 AddTesselationLine(TPS[0], TPS[1], 0); 1839 AddTesselationLine(TPS[0], TPS[2], 1); 1840 AddTesselationLine(TPS[1], TPS[2], 2); 1841 1842 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1843 AddTesselationTriangle(); // add to global map 1844 1845 (*it)->OtherOptCenter.Scale(-1.); 1846 BTS->GetNormalVector((*it)->OtherOptCenter); 1847 (*it)->OtherOptCenter.Scale(-1.); 1848 1849 Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1850 << " for this triangle ... " << endl; 1851 Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl; 1852 } else { 1853 Log() << Verbose(1) << "WARNING: This triangle consisting of "; 1854 Log() << Verbose(0) << *(*it)->point << ", "; 1855 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1856 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1857 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1858 result = false; 1859 } 1860 } else { 1861 Log() << Verbose(1) << "This triangle consisting of "; 1862 Log() << Verbose(0) << *(*it)->point << ", "; 1863 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1864 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1865 Log() << Verbose(0) << "is invalid!" << endl; 1866 result = false; 1867 } 1868 1869 // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 1870 BaseRay = BLS[0]; 1871 if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 1872 Log() << Verbose(1) << "CRITICAL: Triangle " << *BTS << " has zero normal vector!" << endl; 1873 exit(255); 1874 } 1875 1876 } 1877 1878 // remove all candidates from the list and then the list itself 1879 class CandidateForTesselation *remover = NULL; 1880 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1881 remover = *it; 1882 delete(remover); 1883 } 1884 delete(OptCandidates); 1885 Log() << Verbose(0) << "End of FindNextSuitableTriangle\n"; 1977 Log() << Verbose(0) << "Third Points are: " << endl; 1978 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 1979 Log() << Verbose(0) << " " << *(*it) << endl; 1980 } 1981 1982 return true; 1983 1984 // BoundaryLineSet *BaseRay = CandidateLine.BaseLine; 1985 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1986 // Log() << Verbose(0) << "Third point candidate is " << *(*it)->point 1987 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1988 // Log() << Verbose(0) << "Baseline is " << *BaseRay << endl; 1989 // 1990 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1991 // TesselPoint *PointCandidates[3]; 1992 // PointCandidates[0] = (*it)->point; 1993 // PointCandidates[1] = BaseRay->endpoints[0]->node; 1994 // PointCandidates[2] = BaseRay->endpoints[1]->node; 1995 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1996 // 1997 // BTS = NULL; 1998 // // check for present edges and whether we reach better candidates from them 1999 // //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 2000 // if (0) { 2001 // result = false; 2002 // break; 2003 // } else { 2004 // // If there is no triangle, add it regularly. 2005 // if (existentTrianglesCount == 0) { 2006 // AddTesselationPoint((*it)->point, 0); 2007 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2008 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2009 // 2010 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2011 // CandidateLine.point = (*it)->point; 2012 // CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter)); 2013 // CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter)); 2014 // CandidateLine.ShortestAngle = ShortestAngle; 2015 // } else { 2016 //// eLog() << Verbose(1) << "This triangle consisting of "; 2017 //// Log() << Verbose(0) << *(*it)->point << ", "; 2018 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2019 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2020 //// Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl; 2021 // result = false; 2022 // } 2023 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2024 // AddTesselationPoint((*it)->point, 0); 2025 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2026 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2027 // 2028 // // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 2029 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2030 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) { 2031 // CandidateLine.point = (*it)->point; 2032 // CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter); 2033 // CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter); 2034 // CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI; 2035 // 2036 // } else { 2037 //// eLog() << Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl; 2038 // result = false; 2039 // } 2040 // } else { 2041 //// Log() << Verbose(1) << "This triangle consisting of "; 2042 //// Log() << Verbose(0) << *(*it)->point << ", "; 2043 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2044 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2045 //// Log() << Verbose(0) << "is invalid!" << endl; 2046 // result = false; 2047 // } 2048 // } 2049 // 2050 // // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2051 // BaseRay = BLS[0]; 2052 // if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2053 // eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2054 // exit(255); 2055 // } 2056 // 2057 // } 2058 // 2059 // // remove all candidates from the list and then the list itself 2060 // class CandidateForTesselation *remover = NULL; 2061 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2062 // remover = *it; 2063 // delete(remover); 2064 // } 2065 // delete(OptCandidates); 1886 2066 return result; 2067 }; 2068 2069 /** Adds the present line and candidate point from \a &CandidateLine to the Tesselation. 2070 * \param CandidateLine triangle to add 2071 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine() 2072 */ 2073 void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine) 2074 { 2075 Info FunctionInfo(__func__); 2076 Vector Center; 2077 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node; 2078 2079 // fill the set of neighbours 2080 Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2081 Center.SubtractVector(TurningPoint->node); 2082 set<TesselPoint*> SetOfNeighbours; 2083 SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node); 2084 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) 2085 SetOfNeighbours.insert(*Runner); 2086 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center); 2087 2088 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) 2089 TesselPointList::iterator Runner = connectedClosestPoints->begin(); 2090 TesselPointList::iterator Sprinter = Runner; 2091 Sprinter++; 2092 while(Sprinter != connectedClosestPoints->end()) { 2093 // add the points 2094 AddTesselationPoint(TurningPoint, 0); 2095 AddTesselationPoint((*Runner), 1); 2096 AddTesselationPoint((*Sprinter), 2); 2097 2098 Center.CopyVector(&CandidateLine.OptCenter); 2099 // add the lines 2100 AddTesselationLine(TPS[0], TPS[1], 0); 2101 AddTesselationLine(TPS[0], TPS[2], 1); 2102 AddTesselationLine(TPS[1], TPS[2], 2); 2103 2104 // add the triangles 2105 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2106 AddTesselationTriangle(); 2107 Center.Scale(-1.); 2108 BTS->GetNormalVector(Center); 2109 2110 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl; 2111 Runner = Sprinter; 2112 Sprinter++; 2113 } 1887 2114 }; 1888 2115 … … 1896 2123 class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base) 1897 2124 { 2125 Info FunctionInfo(__func__); 1898 2126 class BoundaryPointSet *Spot = NULL; 1899 2127 class BoundaryLineSet *OtherBase; … … 1907 2135 OtherBase = new class BoundaryLineSet(BPS,-1); 1908 2136 1909 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;1910 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2137 Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl; 2138 Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl; 1911 2139 1912 2140 // get the closest point on each line to the other line … … 1928 2156 delete(ClosestPoint); 1929 2157 if ((distance[0] * distance[1]) > 0) { // have same sign? 1930 Log() << Verbose( 3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;2158 Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl; 1931 2159 if (distance[0] < distance[1]) { 1932 2160 Spot = Base->endpoints[0]; … … 1936 2164 return Spot; 1937 2165 } else { // different sign, i.e. we are in between 1938 Log() << Verbose( 3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;2166 Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl; 1939 2167 return NULL; 1940 2168 } … … 1944 2172 void Tesselation::PrintAllBoundaryPoints(ofstream *out) const 1945 2173 { 2174 Info FunctionInfo(__func__); 1946 2175 // print all lines 1947 Log() << Verbose( 1) << "Printing all boundary points for debugging:" << endl;2176 Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl; 1948 2177 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++) 1949 Log() << Verbose( 2) << *(PointRunner->second) << endl;2178 Log() << Verbose(0) << *(PointRunner->second) << endl; 1950 2179 }; 1951 2180 1952 2181 void Tesselation::PrintAllBoundaryLines(ofstream *out) const 1953 2182 { 2183 Info FunctionInfo(__func__); 1954 2184 // print all lines 1955 Log() << Verbose( 1) << "Printing all boundary lines for debugging:" << endl;2185 Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl; 1956 2186 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 1957 Log() << Verbose( 2) << *(LineRunner->second) << endl;2187 Log() << Verbose(0) << *(LineRunner->second) << endl; 1958 2188 }; 1959 2189 1960 2190 void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const 1961 2191 { 2192 Info FunctionInfo(__func__); 1962 2193 // print all triangles 1963 Log() << Verbose( 1) << "Printing all boundary triangles for debugging:" << endl;2194 Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl; 1964 2195 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 1965 Log() << Verbose( 2) << *(TriangleRunner->second) << endl;2196 Log() << Verbose(0) << *(TriangleRunner->second) << endl; 1966 2197 }; 1967 2198 … … 1973 2204 double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base) 1974 2205 { 2206 Info FunctionInfo(__func__); 1975 2207 class BoundaryLineSet *OtherBase; 1976 2208 Vector *ClosestPoint[2]; … … 1984 2216 OtherBase = new class BoundaryLineSet(BPS,-1); 1985 2217 1986 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;1987 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2218 Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl; 2219 Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl; 1988 2220 1989 2221 // get the closest point on each line to the other line … … 2005 2237 2006 2238 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 2007 Log() << Verbose( 3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;2239 Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl; 2008 2240 return false; 2009 2241 } else { // check for sign against BaseLineNormal … … 2011 2243 BaseLineNormal.Zero(); 2012 2244 if (Base->triangles.size() < 2) { 2013 Log() << Verbose(2) << "ERROR:Less than two triangles are attached to this baseline!" << endl;2245 eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl; 2014 2246 return 0.; 2015 2247 } 2016 2248 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2017 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2249 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2018 2250 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2019 2251 } … … 2021 2253 2022 2254 if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 2023 Log() << Verbose( 2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;2255 Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl; 2024 2256 // calculate volume summand as a general tetraeder 2025 2257 return volume; 2026 2258 } else { // Base higher than OtherBase -> do nothing 2027 Log() << Verbose( 2) << "REJECT: Base line is higher: Nothing to do." << endl;2259 Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl; 2028 2260 return 0.; 2029 2261 } … … 2040 2272 class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base) 2041 2273 { 2274 Info FunctionInfo(__func__); 2042 2275 class BoundaryLineSet *OldLines[4], *NewLine; 2043 2276 class BoundaryPointSet *OldPoints[2]; … … 2046 2279 int i,m; 2047 2280 2048 Log() << Verbose(1) << "Begin of FlipBaseline" << endl;2049 2050 2281 // calculate NormalVector for later use 2051 2282 BaseLineNormal.Zero(); 2052 2283 if (Base->triangles.size() < 2) { 2053 Log() << Verbose(2) << "ERROR:Less than two triangles are attached to this baseline!" << endl;2284 eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl; 2054 2285 return NULL; 2055 2286 } 2056 2287 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2057 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2288 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2058 2289 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2059 2290 } … … 2068 2299 i=0; 2069 2300 m=0; 2070 Log() << Verbose( 3) << "The four old lines are: ";2301 Log() << Verbose(0) << "The four old lines are: "; 2071 2302 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2072 2303 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2076 2307 } 2077 2308 Log() << Verbose(0) << endl; 2078 Log() << Verbose( 3) << "The two old points are: ";2309 Log() << Verbose(0) << "The two old points are: "; 2079 2310 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2080 2311 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2087 2318 // check whether everything is in place to create new lines and triangles 2088 2319 if (i<4) { 2089 Log() << Verbose(1) << "ERROR:We have not gathered enough baselines!" << endl;2320 eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl; 2090 2321 return NULL; 2091 2322 } 2092 2323 for (int j=0;j<4;j++) 2093 2324 if (OldLines[j] == NULL) { 2094 Log() << Verbose(1) << "ERROR:We have not gathered enough baselines!" << endl;2325 eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl; 2095 2326 return NULL; 2096 2327 } 2097 2328 for (int j=0;j<2;j++) 2098 2329 if (OldPoints[j] == NULL) { 2099 Log() << Verbose(1) << "ERROR:We have not gathered enough endpoints!" << endl;2330 eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl; 2100 2331 return NULL; 2101 2332 } 2102 2333 2103 2334 // remove triangles and baseline removes itself 2104 Log() << Verbose( 3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;2335 Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl; 2105 2336 OldBaseLineNr = Base->Nr; 2106 2337 m=0; 2107 2338 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2108 Log() << Verbose( 3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;2339 Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl; 2109 2340 OldTriangleNrs[m++] = runner->second->Nr; 2110 2341 RemoveTesselationTriangle(runner->second); … … 2116 2347 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 2117 2348 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 2118 Log() << Verbose( 3) << "INFO: Created new baseline " << *NewLine << "." << endl;2349 Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl; 2119 2350 2120 2351 // construct new triangles with flipped baseline … … 2131 2362 BTS->GetNormalVector(BaseLineNormal); 2132 2363 AddTesselationTriangle(OldTriangleNrs[0]); 2133 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2364 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2134 2365 2135 2366 BLS[0] = (i==2 ? OldLines[3] : OldLines[2]); … … 2139 2370 BTS->GetNormalVector(BaseLineNormal); 2140 2371 AddTesselationTriangle(OldTriangleNrs[1]); 2141 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2372 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2142 2373 } else { 2143 Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;2374 eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl; 2144 2375 return NULL; 2145 2376 } 2146 2377 2147 Log() << Verbose(1) << "End of FlipBaseline" << endl;2148 2378 return NewLine; 2149 2379 }; … … 2160 2390 void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC) 2161 2391 { 2162 Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;2392 Info FunctionInfo(__func__); 2163 2393 Vector AngleCheck; 2164 2394 class TesselPoint* Candidate = NULL; … … 2173 2403 N[i] = LC->n[i]; 2174 2404 } else { 2175 eLog() << Verbose( 0) << "ERROR:Point " << *a << " is not found in cell " << LC->index << "." << endl;2405 eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl; 2176 2406 return; 2177 2407 } 2178 2408 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2179 Log() << Verbose(3) << "LC Intervals from [";2180 for (int i=0;i<NDIM;i++) {2181 Log() << Verbose(0) << " " << N[i] << "<->" << LC->N[i];2182 }2183 Log() << Verbose(0) << "] :";2184 2409 for (int i=0;i<NDIM;i++) { 2185 2410 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; 2186 2411 Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1; 2187 Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] "; 2188 } 2189 Log() << Verbose(0) << endl; 2190 2412 } 2413 Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" 2414 << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl; 2191 2415 2192 2416 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) … … 2194 2418 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2195 2419 const LinkedNodes *List = LC->GetCurrentCell(); 2196 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2420 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2197 2421 if (List != NULL) { 2198 2422 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2225 2449 angle = AngleCheck.Angle(&Oben); 2226 2450 if (angle < Storage[0]) { 2227 //Log() << Verbose( 3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);2228 Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";2451 //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 2452 Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"; 2229 2453 OptCandidate = Candidate; 2230 2454 Storage[0] = angle; 2231 //Log() << Verbose( 3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);2455 //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]); 2232 2456 } else { 2233 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;2457 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl; 2234 2458 } 2235 2459 } else { 2236 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;2460 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl; 2237 2461 } 2238 2462 } else { 2239 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;2463 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl; 2240 2464 } 2241 2465 } 2242 2466 } else { 2243 Log() << Verbose( 3) << "Linked cell list is empty." << endl;2467 Log() << Verbose(0) << "Linked cell list is empty." << endl; 2244 2468 } 2245 2469 } 2246 Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;2247 2470 }; 2248 2471 … … 2273 2496 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine 2274 2497 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle 2275 * @param BaseLine BoundaryLineSet with the current base line2498 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle 2276 2499 * @param ThirdNode third point to avoid in search 2277 * @param candidates list of equally good candidates to return2278 * @param ShortestAngle the current path length on this circle band for the current OptCandidate2279 2500 * @param RADIUS radius of sphere 2280 2501 * @param *LC LinkedCell structure with neighbouring points 2281 2502 */ 2282 void Tesselation::FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) 2283 { 2503 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const 2504 { 2505 Info FunctionInfo(__func__); 2284 2506 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 2285 2507 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in … … 2294 2516 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 2295 2517 TesselPoint *Candidate = NULL; 2296 CandidateForTesselation *optCandidate = NULL; 2297 2298 Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl; 2299 2300 Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2518 2519 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2301 2520 2302 2521 // construct center of circle 2303 CircleCenter.CopyVector( BaseLine->endpoints[0]->node->node);2304 CircleCenter.AddVector( BaseLine->endpoints[1]->node->node);2522 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2523 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2305 2524 CircleCenter.Scale(0.5); 2306 2525 2307 2526 // construct normal vector of circle 2308 CirclePlaneNormal.CopyVector( BaseLine->endpoints[0]->node->node);2309 CirclePlaneNormal.SubtractVector( BaseLine->endpoints[1]->node->node);2527 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2528 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2310 2529 2311 2530 // calculate squared radius TesselPoint *ThirdNode,f circle … … 2314 2533 CircleRadius = RADIUS*RADIUS - radius/4.; 2315 2534 CirclePlaneNormal.Normalize(); 2316 //Log() << Verbose( 2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;2535 //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2317 2536 2318 2537 // test whether old center is on the band's plane 2319 2538 if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { 2320 eLog() << Verbose( 0) << "ERROR:Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;2539 eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl; 2321 2540 OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal); 2322 2541 } 2323 2542 radius = OldSphereCenter.ScalarProduct(&OldSphereCenter); 2324 2543 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2325 //Log() << Verbose( 2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;2544 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 2326 2545 2327 2546 // check SearchDirection 2328 //Log() << Verbose( 2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;2547 //Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2329 2548 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2330 eLog() << Verbose( 0) << "ERROR:SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;2549 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl; 2331 2550 } 2332 2551 … … 2335 2554 for(int i=0;i<NDIM;i++) // store indices of this cell 2336 2555 N[i] = LC->n[i]; 2337 //Log() << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2556 //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 2338 2557 } else { 2339 eLog() << Verbose( 0) << "ERROR:Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;2558 eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl; 2340 2559 return; 2341 2560 } 2342 2561 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2343 //Log() << Verbose( 2) << "LC Intervals:";2562 //Log() << Verbose(1) << "LC Intervals:"; 2344 2563 for (int i=0;i<NDIM;i++) { 2345 2564 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; … … 2352 2571 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2353 2572 const LinkedNodes *List = LC->GetCurrentCell(); 2354 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2573 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2355 2574 if (List != NULL) { 2356 2575 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2358 2577 2359 2578 // check for three unique points 2360 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node<< "." << endl;2361 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate !=BaseLine->endpoints[1]->node) ){2579 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << *(Candidate->node) << "." << endl; 2580 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){ 2362 2581 2363 2582 // construct both new centers 2364 GetCenterofCircumcircle(&NewSphereCenter, * BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);2583 GetCenterofCircumcircle(&NewSphereCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node); 2365 2584 OtherNewSphereCenter.CopyVector(&NewSphereCenter); 2366 2585 2367 if ((NewNormalVector.MakeNormalVector( BaseLine->endpoints[0]->node->node,BaseLine->endpoints[1]->node->node, Candidate->node))2586 if ((NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node)) 2368 2587 && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON) 2369 2588 ) { 2370 2589 helper.CopyVector(&NewNormalVector); 2371 //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;2372 radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);2590 Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2591 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter); 2373 2592 if (radius < RADIUS*RADIUS) { 2374 2593 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2375 //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;2594 Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl; 2376 2595 NewSphereCenter.AddVector(&helper); 2377 2596 NewSphereCenter.SubtractVector(&CircleCenter); 2378 //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;2597 Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2379 2598 2380 2599 // OtherNewSphereCenter is created by the same vector just in the other direction … … 2382 2601 OtherNewSphereCenter.AddVector(&helper); 2383 2602 OtherNewSphereCenter.SubtractVector(&CircleCenter); 2384 //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;2603 Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2385 2604 2386 2605 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); … … 2389 2608 // if there is a better candidate, drop the current list and add the new candidate 2390 2609 // otherwise ignore the new candidate and keep the list 2391 if (*ShortestAngle > (alpha - HULLEPSILON)) { 2392 optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter); 2610 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2393 2611 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2394 optCandidate->OptCenter.CopyVector(&NewSphereCenter);2395 optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);2612 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2613 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2396 2614 } else { 2397 optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);2398 optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);2615 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2616 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2399 2617 } 2400 2618 // if there is an equal candidate, add it to the list without clearing the list 2401 if (( *ShortestAngle - HULLEPSILON) < alpha) {2402 candidates->push_back(optCandidate);2403 Log() << Verbose( 2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "2404 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;2619 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2620 CandidateLine.pointlist.push_back(Candidate); 2621 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2622 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2405 2623 } else { 2406 2624 // remove all candidates from the list and then the list itself 2407 class CandidateForTesselation *remover = NULL; 2408 for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) { 2409 remover = *it; 2410 delete(remover); 2411 } 2412 candidates->clear(); 2413 candidates->push_back(optCandidate); 2414 Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with " 2415 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl; 2625 CandidateLine.pointlist.clear(); 2626 CandidateLine.pointlist.push_back(Candidate); 2627 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2628 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2416 2629 } 2417 *ShortestAngle = alpha;2418 //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;2630 CandidateLine.ShortestAngle = alpha; 2631 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2419 2632 } else { 2420 if (( optCandidate != NULL) && (optCandidate->point != NULL)) {2421 //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;2633 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2634 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2422 2635 } else { 2423 //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;2636 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2424 2637 } 2425 2638 } 2426 2639 2427 2640 } else { 2428 //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;2641 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl; 2429 2642 } 2430 2643 } else { 2431 //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2644 Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl; 2432 2645 } 2433 2646 } else { 2434 2647 if (ThirdNode != NULL) { 2435 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;2648 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl; 2436 2649 } else { 2437 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;2650 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl; 2438 2651 } 2439 2652 } … … 2442 2655 } 2443 2656 } else { 2444 eLog() << Verbose( 2) << "ERROR:The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;2657 eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl; 2445 2658 } 2446 2659 } else { 2447 2660 if (ThirdNode != NULL) 2448 Log() << Verbose( 2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;2661 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl; 2449 2662 else 2450 Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl; 2451 } 2452 2453 //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl; 2454 if (candidates->size() > 1) { 2455 candidates->unique(); 2456 candidates->sort(SortCandidates); 2457 } 2458 2459 Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl; 2663 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl; 2664 } 2665 2666 Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl; 2667 if (CandidateLine.pointlist.size() > 1) { 2668 CandidateLine.pointlist.unique(); 2669 CandidateLine.pointlist.sort(); //SortCandidates); 2670 } 2460 2671 }; 2461 2672 … … 2467 2678 class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const 2468 2679 { 2680 Info FunctionInfo(__func__); 2469 2681 const BoundaryLineSet * lines[2] = { line1, line2 }; 2470 2682 class BoundaryPointSet *node = NULL; … … 2480 2692 { // if insertion fails, we have common endpoint 2481 2693 node = OrderTest.first->second; 2482 Log() << Verbose( 5) << "Common endpoint of lines " << *line12694 Log() << Verbose(1) << "Common endpoint of lines " << *line1 2483 2695 << " and " << *line2 << " is: " << *node << "." << endl; 2484 2696 j = 2; … … 2497 2709 list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const 2498 2710 { 2711 Info FunctionInfo(__func__); 2499 2712 TesselPoint *trianglePoints[3]; 2500 2713 TesselPoint *SecondPoint = NULL; … … 2502 2715 2503 2716 if (LinesOnBoundary.empty()) { 2504 Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";2717 eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first."; 2505 2718 return NULL; 2506 2719 } … … 2510 2723 // check whether closest point is "too close" :), then it's inside 2511 2724 if (trianglePoints[0] == NULL) { 2512 Log() << Verbose( 2) << "Is the only point, no one else is closeby." << endl;2725 Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl; 2513 2726 return NULL; 2514 2727 } 2515 2728 if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) { 2516 Log() << Verbose( 3) << "Point is right on a tesselation point, no nearest triangle." << endl;2729 Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl; 2517 2730 PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr); 2518 2731 triangles = new list<BoundaryTriangleSet*>; … … 2533 2746 triangles->unique(); 2534 2747 } else { 2535 Log() << Verbose(1) << "ERROR:I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;2748 eLog() << Verbose(1) << "I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl; 2536 2749 return NULL; 2537 2750 } 2538 2751 } 2539 2752 } else { 2540 list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x); 2753 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]); 2754 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x); 2755 delete(connectedPoints); 2541 2756 if (connectedClosestPoints != NULL) { 2542 2757 trianglePoints[1] = connectedClosestPoints->front(); … … 2544 2759 for (int i=0;i<3;i++) { 2545 2760 if (trianglePoints[i] == NULL) { 2546 Log() << Verbose(1) << "ERROR:IsInnerPoint encounters serious error, point " << i << " not found." << endl;2761 eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl; 2547 2762 } 2548 //Log() << Verbose( 2) << "List of triangle points:" << endl;2549 //Log() << Verbose( 3) << *trianglePoints[i] << endl;2763 //Log() << Verbose(1) << "List of triangle points:" << endl; 2764 //Log() << Verbose(2) << *trianglePoints[i] << endl; 2550 2765 } 2551 2766 2552 2767 triangles = FindTriangles(trianglePoints); 2553 Log() << Verbose( 2) << "List of possible triangles:" << endl;2768 Log() << Verbose(1) << "List of possible triangles:" << endl; 2554 2769 for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) 2555 Log() << Verbose( 3) << **Runner << endl;2770 Log() << Verbose(2) << **Runner << endl; 2556 2771 2557 2772 delete(connectedClosestPoints); 2558 2773 } else { 2559 2774 triangles = NULL; 2560 Log() << Verbose(1) << "There is no circle of connected points!" << endl;2775 eLog() << Verbose(2) << "There is no circle of connected points!" << endl; 2561 2776 } 2562 2777 } 2563 2778 2564 2779 if ((triangles == NULL) || (triangles->empty())) { 2565 Log() << Verbose(0) << "ERROR:There is no nearest triangle. Please check the tesselation structure.";2780 eLog() << Verbose(1) << "There is no nearest triangle. Please check the tesselation structure."; 2566 2781 delete(triangles); 2567 2782 return NULL; … … 2578 2793 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const 2579 2794 { 2795 Info FunctionInfo(__func__); 2580 2796 class BoundaryTriangleSet *result = NULL; 2581 2797 list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC); … … 2587 2803 if (triangles->size() == 1) { // there is no degenerate case 2588 2804 result = triangles->front(); 2589 Log() << Verbose( 2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;2805 Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl; 2590 2806 } else { 2591 2807 result = triangles->front(); 2592 2808 result->GetCenter(&Center); 2593 2809 Center.SubtractVector(x); 2594 Log() << Verbose( 2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;2810 Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl; 2595 2811 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2596 2812 result = triangles->back(); 2597 Log() << Verbose( 2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;2813 Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl; 2598 2814 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2599 Log() << Verbose(1) << "ERROR:Front and back side yield NormalVector in wrong direction!" << endl;2815 eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl; 2600 2816 } 2601 2817 } … … 2614 2830 bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const 2615 2831 { 2832 Info FunctionInfo(__func__); 2616 2833 class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC); 2617 2834 Vector Center; … … 2623 2840 2624 2841 result->GetCenter(&Center); 2625 Log() << Verbose( 3) << "INFO: Central point of the triangle is " << Center << "." << endl;2842 Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl; 2626 2843 Center.SubtractVector(&Point); 2627 Log() << Verbose( 3) << "INFO: Vector from center to point to test is " << Center << "." << endl;2844 Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl; 2628 2845 if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) { 2629 2846 Log() << Verbose(1) << Point << " is an inner point." << endl; … … 2644 2861 bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const 2645 2862 { 2863 Info FunctionInfo(__func__); 2646 2864 return IsInnerPoint(*(Point->node), LC); 2647 2865 } … … 2655 2873 set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const 2656 2874 { 2875 Info FunctionInfo(__func__); 2657 2876 set<TesselPoint*> *connectedPoints = new set<TesselPoint*>; 2658 2877 class BoundaryPointSet *ReferencePoint = NULL; 2659 2878 TesselPoint* current; 2660 2879 bool takePoint = false; 2661 2662 Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;2663 2880 2664 2881 // find the respective boundary point … … 2667 2884 ReferencePoint = PointRunner->second; 2668 2885 } else { 2669 Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;2886 eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 2670 2887 ReferencePoint = NULL; 2671 2888 } … … 2691 2908 2692 2909 if (takePoint) { 2693 Log() << Verbose( 5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;2910 Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl; 2694 2911 connectedPoints->insert(current); 2695 2912 } … … 2699 2916 2700 2917 if (connectedPoints->size() == 0) { // if have not found any points 2701 Log() << Verbose(1) << "ERROR:We have not found any connected points to " << *Point<< "." << endl;2918 eLog() << Verbose(1) << "We have not found any connected points to " << *Point<< "." << endl; 2702 2919 return NULL; 2703 2920 } 2704 2921 2705 Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;2706 2922 return connectedPoints; 2707 2923 }; … … 2715 2931 * 2716 2932 * @param *out output stream for debugging 2933 * @param *SetOfNeighbours all points for which the angle should be calculated 2717 2934 * @param *Point of which get all connected points 2718 2935 * @param *Reference Reference vector for zero angle or NULL for no preference 2719 2936 * @return list of the all points linked to the provided one 2720 2937 */ 2721 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const 2722 { 2938 list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const 2939 { 2940 Info FunctionInfo(__func__); 2723 2941 map<double, TesselPoint*> anglesOfPoints; 2724 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);2725 2942 list<TesselPoint*> *connectedCircle = new list<TesselPoint*>; 2726 2943 Vector center; … … 2730 2947 Vector helper; 2731 2948 2732 if ( connectedPoints == NULL) {2733 Log() << Verbose(2) << "Could not find any connected points!" << endl;2949 if (SetOfNeighbours == NULL) { 2950 eLog() << Verbose(2) << "Could not find any connected points!" << endl; 2734 2951 delete(connectedCircle); 2735 2952 return NULL; 2736 2953 } 2737 Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;2738 2954 2739 2955 // calculate central point 2740 for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)2956 for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++) 2741 2957 center.AddVector((*TesselRunner)->node); 2742 2958 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2743 2959 // << "; scale factor " << 1.0/connectedPoints.size(); 2744 center.Scale(1.0/ connectedPoints->size());2745 Log() << Verbose( 4) << "INFO: Calculated center of all circle points is " << center << "." << endl;2960 center.Scale(1.0/SetOfNeighbours->size()); 2961 Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl; 2746 2962 2747 2963 // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 2749 2965 PlaneNormal.SubtractVector(¢er); 2750 2966 PlaneNormal.Normalize(); 2751 Log() << Verbose( 4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;2967 Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl; 2752 2968 2753 2969 // construct one orthogonal vector … … 2758 2974 } 2759 2975 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) { 2760 Log() << Verbose( 4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;2761 AngleZero.CopyVector((* connectedPoints->begin())->node);2976 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl; 2977 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 2762 2978 AngleZero.SubtractVector(Point->node); 2763 2979 AngleZero.ProjectOntoPlane(&PlaneNormal); … … 2767 2983 } 2768 2984 } 2769 Log() << Verbose( 4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;2985 Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl; 2770 2986 if (AngleZero.NormSquared() > MYEPSILON) 2771 2987 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 2772 2988 else 2773 2989 OrthogonalVector.MakeNormalVector(&PlaneNormal); 2774 Log() << Verbose( 4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;2990 Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl; 2775 2991 2776 2992 // go through all connected points and calculate angle 2777 for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {2993 for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) { 2778 2994 helper.CopyVector((*listRunner)->node); 2779 2995 helper.SubtractVector(Point->node); 2780 2996 helper.ProjectOntoPlane(&PlaneNormal); 2781 2997 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 2782 Log() << Verbose( 3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;2998 Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl; 2783 2999 anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner))); 2784 3000 } … … 2787 3003 connectedCircle->push_back(AngleRunner->second); 2788 3004 } 2789 2790 delete(connectedPoints);2791 2792 Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;2793 3005 2794 3006 return connectedCircle; … … 2803 3015 list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const 2804 3016 { 3017 Info FunctionInfo(__func__); 2805 3018 map<double, TesselPoint*> anglesOfPoints; 2806 3019 list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>; … … 2822 3035 ReferencePoint = PointRunner->second; 2823 3036 } else { 2824 Log() << Verbose(2) << "ERROR:GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;3037 eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 2825 3038 return NULL; 2826 3039 } … … 2839 3052 LineRunner = TouchedLine.find(runner->second); 2840 3053 if (LineRunner == TouchedLine.end()) { 2841 Log() << Verbose(2) << "ERROR:I could not find " << *runner->second << " in the touched list." << endl;3054 eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl; 2842 3055 } else if (!LineRunner->second) { 2843 3056 LineRunner->second = true; … … 2847 3060 StartLine = CurrentLine; 2848 3061 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 2849 Log() << Verbose( 3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;3062 Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl; 2850 3063 do { 2851 3064 // push current one 2852 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3065 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 2853 3066 connectedPath->push_back(CurrentPoint->node); 2854 3067 2855 3068 // find next triangle 2856 3069 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 2857 Log() << Verbose( 3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;3070 Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl; 2858 3071 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 2859 3072 triangle = Runner->second; … … 2862 3075 if (!TriangleRunner->second) { 2863 3076 TriangleRunner->second = true; 2864 Log() << Verbose( 3) << "INFO: Connecting triangle is " << *triangle << "." << endl;3077 Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl; 2865 3078 break; 2866 3079 } else { 2867 Log() << Verbose( 3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;3080 Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl; 2868 3081 triangle = NULL; 2869 3082 } 2870 3083 } else { 2871 Log() << Verbose(2) << "ERROR:I could not find " << *triangle << " in the touched list." << endl;3084 eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl; 2872 3085 triangle = NULL; 2873 3086 } … … 2880 3093 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 2881 3094 CurrentLine = triangle->lines[i]; 2882 Log() << Verbose( 3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;3095 Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl; 2883 3096 break; 2884 3097 } … … 2886 3099 LineRunner = TouchedLine.find(CurrentLine); 2887 3100 if (LineRunner == TouchedLine.end()) 2888 Log() << Verbose(2) << "ERROR:I could not find " << *CurrentLine << " in the touched list." << endl;3101 eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl; 2889 3102 else 2890 3103 LineRunner->second = true; … … 2894 3107 } while (CurrentLine != StartLine); 2895 3108 // last point is missing, as it's on start line 2896 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3109 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 2897 3110 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 2898 3111 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 2900 3113 ListOfPaths->push_back(connectedPath); 2901 3114 } else { 2902 Log() << Verbose( 3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;3115 Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl; 2903 3116 } 2904 3117 } 2905 3118 } else { 2906 Log() << Verbose(1) << "ERROR:There are no lines attached to " << *ReferencePoint << "." << endl;3119 eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl; 2907 3120 } 2908 3121 … … 2918 3131 list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const 2919 3132 { 3133 Info FunctionInfo(__func__); 2920 3134 list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point); 2921 3135 list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>; … … 2931 3145 connectedPath = *ListRunner; 2932 3146 2933 Log() << Verbose( 2) << "INFO: Current path is " << connectedPath << "." << endl;3147 Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl; 2934 3148 2935 3149 // go through list, look for reappearance of starting Point and count … … 2941 3155 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 2942 3156 // we have a closed circle from Marker to new Marker 2943 Log() << Verbose( 3) << count+1 << ". closed path consists of: ";3157 Log() << Verbose(1) << count+1 << ". closed path consists of: "; 2944 3158 newPath = new list<TesselPoint*>; 2945 3159 list<TesselPoint*>::iterator CircleSprinter = Marker; … … 2957 3171 } 2958 3172 } 2959 Log() << Verbose( 3) << "INFO: " << count << " closed additional path(s) have been created." << endl;3173 Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl; 2960 3174 2961 3175 // delete list of paths … … 2979 3193 set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const 2980 3194 { 3195 Info FunctionInfo(__func__); 2981 3196 set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>; 2982 3197 2983 3198 if (Point == NULL) { 2984 Log() << Verbose(1) << "ERROR:Point given is NULL." << endl;3199 eLog() << Verbose(1) << "Point given is NULL." << endl; 2985 3200 } else { 2986 3201 // go through its lines and insert all triangles … … 3014 3229 3015 3230 if (point == NULL) { 3016 Log() << Verbose(1) << "ERROR:Cannot remove the point " << point << ", it's NULL!" << endl;3231 eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl; 3017 3232 return 0.; 3018 3233 } else 3019 Log() << Verbose( 2) << "Removing point " << *point << " from tesselated boundary ..." << endl;3234 Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl; 3020 3235 3021 3236 // copy old location for the volume … … 3024 3239 // get list of connected points 3025 3240 if (point->lines.empty()) { 3026 Log() << Verbose(1) << "ERROR:Cannot remove the point " << *point << ", it's connected to no lines!" << endl;3241 eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl; 3027 3242 return 0.; 3028 3243 } … … 3047 3262 NormalVector.Zero(); 3048 3263 for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3049 Log() << Verbose( 3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;3264 Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl; 3050 3265 NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward 3051 3266 RemoveTesselationTriangle(Runner->first); … … 3077 3292 smallestangle = 0.; 3078 3293 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3079 Log() << Verbose( 3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3294 Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3080 3295 // construct vectors to next and previous neighbour 3081 3296 StartNode = MiddleNode; … … 3105 3320 MiddleNode = EndNode; 3106 3321 if (MiddleNode == connectedPath->end()) { 3107 Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;3108 exit(255);3322 eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl; 3323 performCriticalExit(); 3109 3324 } 3110 3325 StartNode = MiddleNode; … … 3115 3330 if (EndNode == connectedPath->end()) 3116 3331 EndNode = connectedPath->begin(); 3117 Log() << Verbose( 4) << "INFO: StartNode is " << **StartNode << "." << endl;3118 Log() << Verbose( 4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3119 Log() << Verbose( 4) << "INFO: EndNode is " << **EndNode << "." << endl;3120 Log() << Verbose( 3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;3332 Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl; 3333 Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3334 Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl; 3335 Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl; 3121 3336 TriangleCandidates[0] = *StartNode; 3122 3337 TriangleCandidates[1] = *MiddleNode; … … 3124 3339 triangle = GetPresentTriangle(TriangleCandidates); 3125 3340 if (triangle != NULL) { 3126 Log() << Verbose(1) << "WARNING:New triangle already present, skipping!" << endl;3341 eLog() << Verbose(0) << "New triangle already present, skipping!" << endl; 3127 3342 StartNode++; 3128 3343 MiddleNode++; … … 3136 3351 continue; 3137 3352 } 3138 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3353 Log() << Verbose(3) << "Adding new triangle points."<< endl; 3139 3354 AddTesselationPoint(*StartNode, 0); 3140 3355 AddTesselationPoint(*MiddleNode, 1); 3141 3356 AddTesselationPoint(*EndNode, 2); 3142 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3357 Log() << Verbose(3) << "Adding new triangle lines."<< endl; 3143 3358 AddTesselationLine(TPS[0], TPS[1], 0); 3144 3359 AddTesselationLine(TPS[0], TPS[2], 1); … … 3155 3370 // prepare nodes for next triangle 3156 3371 StartNode = EndNode; 3157 Log() << Verbose( 4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;3372 Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl; 3158 3373 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3159 3374 if (connectedPath->size() == 2) { // we are done … … 3162 3377 break; 3163 3378 } else if (connectedPath->size() < 2) { // something's gone wrong! 3164 Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;3165 exit(255);3379 eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl; 3380 performCriticalExit(); 3166 3381 } else { 3167 3382 MiddleNode = StartNode; … … 3191 3406 if (maxgain != 0) { 3192 3407 volume += maxgain; 3193 Log() << Verbose( 3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;3408 Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl; 3194 3409 OtherBase = FlipBaseline(*Candidate); 3195 3410 NewLines.erase(Candidate); … … 3202 3417 delete(connectedPath); 3203 3418 } 3204 Log() << Verbose( 1) << count << " triangles were created." << endl;3419 Log() << Verbose(0) << count << " triangles were created." << endl; 3205 3420 } else { 3206 3421 while (!ListOfClosedPaths->empty()) { … … 3210 3425 delete(connectedPath); 3211 3426 } 3212 Log() << Verbose( 1) << "No need to create any triangles." << endl;3427 Log() << Verbose(0) << "No need to create any triangles." << endl; 3213 3428 } 3214 3429 delete(ListOfClosedPaths); 3215 3430 3216 Log() << Verbose( 1) << "Removed volume is " << volume << "." << endl;3431 Log() << Verbose(0) << "Removed volume is " << volume << "." << endl; 3217 3432 3218 3433 return volume; … … 3231 3446 list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const 3232 3447 { 3448 Info FunctionInfo(__func__); 3233 3449 list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>; 3234 3450 LineMap::const_iterator FindLine; … … 3279 3495 map<int, int> * Tesselation::FindAllDegeneratedLines() 3280 3496 { 3497 Info FunctionInfo(__func__); 3281 3498 map<int, class BoundaryLineSet *> AllLines; 3282 3499 map<int, int> * DegeneratedLines = new map<int, int>; … … 3284 3501 // sanity check 3285 3502 if (LinesOnBoundary.empty()) { 3286 Log() << Verbose(1) << "Warning:FindAllDegeneratedTriangles() was called without any tesselation structure.";3503 eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure."; 3287 3504 return DegeneratedLines; 3288 3505 } … … 3300 3517 AllLines.clear(); 3301 3518 3302 Log() << Verbose( 1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;3519 Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl; 3303 3520 map<int,int>::iterator it; 3304 3521 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) 3305 Log() << Verbose( 2) << (*it).first << " => " << (*it).second << endl;3522 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 3306 3523 3307 3524 return DegeneratedLines; … … 3316 3533 map<int, int> * Tesselation::FindAllDegeneratedTriangles() 3317 3534 { 3535 Info FunctionInfo(__func__); 3318 3536 map<int, int> * DegeneratedLines = FindAllDegeneratedLines(); 3319 3537 map<int, int> * DegeneratedTriangles = new map<int, int>; … … 3343 3561 delete(DegeneratedLines); 3344 3562 3345 Log() << Verbose( 1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;3563 Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl; 3346 3564 map<int,int>::iterator it; 3347 3565 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3348 Log() << Verbose( 2) << (*it).first << " => " << (*it).second << endl;3566 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 3349 3567 3350 3568 return DegeneratedTriangles; … … 3357 3575 void Tesselation::RemoveDegeneratedTriangles() 3358 3576 { 3577 Info FunctionInfo(__func__); 3359 3578 map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles(); 3360 3579 TriangleMap::iterator finder; 3361 3580 BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL; 3362 3581 int count = 0; 3363 3364 Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;3365 3582 3366 3583 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); … … 3421 3638 // erase the pair 3422 3639 count += (int) DegeneratedTriangles->erase(triangle->Nr); 3423 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;3640 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl; 3424 3641 RemoveTesselationTriangle(triangle); 3425 3642 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 3426 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;3643 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl; 3427 3644 RemoveTesselationTriangle(partnerTriangle); 3428 3645 } else { 3429 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle3646 Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle 3430 3647 << " and its partner " << *partnerTriangle << " because it is essential for at" 3431 3648 << " least one of the endpoints to be kept in the tesselation structure." << endl; … … 3433 3650 } 3434 3651 delete(DegeneratedTriangles); 3435 3436 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3437 Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl; 3652 if (count > 0) 3653 LastTriangle = NULL; 3654 3655 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3438 3656 } 3439 3657 … … 3448 3666 void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC) 3449 3667 { 3450 Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl; 3451 3668 Info FunctionInfo(__func__); 3452 3669 // find nearest boundary point 3453 3670 class TesselPoint *BackupPoint = NULL; … … 3462 3679 NearestBoundaryPoint = PointRunner->second; 3463 3680 } else { 3464 Log() << Verbose(1) << "ERROR:I cannot find the boundary point." << endl;3681 eLog() << Verbose(1) << "I cannot find the boundary point." << endl; 3465 3682 return; 3466 3683 } 3467 Log() << Verbose( 2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;3684 Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl; 3468 3685 3469 3686 // go through its lines and find the best one to split … … 3498 3715 3499 3716 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 3500 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3717 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3501 3718 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3502 3719 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3503 3720 AddTesselationPoint(point, 2); 3504 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3721 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3505 3722 AddTesselationLine(TPS[0], TPS[1], 0); 3506 3723 AddTesselationLine(TPS[0], TPS[2], 1); … … 3509 3726 BTS->GetNormalVector(TempTriangle->NormalVector); 3510 3727 BTS->NormalVector.Scale(-1.); 3511 Log() << Verbose( 3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;3728 Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl; 3512 3729 AddTesselationTriangle(); 3513 3730 3514 3731 // create other side of this triangle and close both new sides of the first created triangle 3515 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3732 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3516 3733 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3517 3734 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3518 3735 AddTesselationPoint(point, 2); 3519 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3736 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3520 3737 AddTesselationLine(TPS[0], TPS[1], 0); 3521 3738 AddTesselationLine(TPS[0], TPS[2], 1); … … 3523 3740 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 3524 3741 BTS->GetNormalVector(TempTriangle->NormalVector); 3525 Log() << Verbose( 3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;3742 Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl; 3526 3743 AddTesselationTriangle(); 3527 3744 … … 3530 3747 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 3531 3748 if (BestLine == BTS->lines[i]){ 3532 Log() << Verbose(1) << "CRITICAL:BestLine is same as found line, something's wrong here!" << endl;3533 exit(255);3749 eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl; 3750 performCriticalExit(); 3534 3751 } 3535 3752 BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) ); … … 3538 3755 } 3539 3756 } 3540 3541 // exit3542 Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;3543 3757 }; 3544 3758 … … 3550 3764 void Tesselation::Output(const char *filename, const PointCloud * const cloud) 3551 3765 { 3766 Info FunctionInfo(__func__); 3552 3767 ofstream *tempstream = NULL; 3553 3768 string NameofTempFile; … … 3562 3777 NameofTempFile.erase(npos, 1); 3563 3778 NameofTempFile.append(TecplotSuffix); 3564 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3779 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3565 3780 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3566 3781 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 3576 3791 NameofTempFile.erase(npos, 1); 3577 3792 NameofTempFile.append(Raster3DSuffix); 3578 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3793 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3579 3794 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3580 3795 WriteRaster3dFile(tempstream, this, cloud);
Note:
See TracChangeset
for help on using the changeset viewer.