Changes in / [0b2dd2:482373]
- Files:
-
- 8 deleted
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r0b2dd2 r482373 5 5 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 6 6 7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cppleastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hppleastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp 8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp 9 9 10 10 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) … … 25 25 26 26 #EXTRA_DIST = ${molecuilder_DATA} 27 28 FORCE:29 $(srcdir)/.git-version: FORCE30 @if (test -d $(top_srcdir)/../.git && cd $(srcdir) && git describe HEAD) > .git-version-t 2>/dev/null \31 && ! diff .git-version-t $(srcdir)/.git-version >/dev/null 2>&1; then \32 mv -f .git-version-t $(srcdir)/.git-version; \33 else \34 rm -f .git-version-t; \35 fi36 37 EXTRA_DIST = $(srcdir)/.git-version38 39 $(srcdir)/version.c: $(srcdir)/.git-version40 echo "const char *ESPACKVersion = \"$(PACKAGE_NAME) -- git version: "`cat $(srcdir)/.git-version`"\";" > $@41 42 molecuilder_SOURCES += $(srcdir)/version.c -
src/atom_bondedparticle.cpp
r0b2dd2 r482373 121 121 bond *CandidateBond = NULL; 122 122 123 //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl; 123 124 NoBonds = CountBonds(); 124 //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;125 125 if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch 126 126 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) { 127 127 OtherWalker = (*Runner)->GetOtherAtom(this); 128 128 OtherNoBonds = OtherWalker->CountBonds(); 129 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;130 if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate129 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl; 130 if ((int)(OtherWalker->type->NoValenceOrbitals) > NoBonds) { // check if possible candidate 131 131 if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first 132 132 CandidateBond = (*Runner); … … 137 137 if ((CandidateBond != NULL)) { 138 138 CandidateBond->BondDegree++; 139 //Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;139 Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl; 140 140 } else { 141 eLog() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;141 //Log() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl; 142 142 FalseBondDegree++; 143 143 } -
src/bondgraph.cpp
r0b2dd2 r482373 35 35 /** Parses the bond lengths in a given file and puts them int a matrix form. 36 36 * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(), 37 * but only if parsing is successful . Otherwise variable is left as NULL.37 * but only if parsing is successfull. Otherwise variable is left as NULL. 38 38 * \param *out output stream for debugging 39 39 * \param filename file with bond lengths to parse -
src/boundary.cpp
r0b2dd2 r482373 10 10 #include "element.hpp" 11 11 #include "helpers.hpp" 12 #include "info.hpp"13 12 #include "linkedcell.hpp" 14 13 #include "log.hpp" … … 34 33 double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem) 35 34 { 36 Info FunctionInfo(__func__);37 35 // get points on boundary of NULL was given as parameter 38 36 bool BoundaryFreeFlag = false; … … 55 53 } else { 56 54 BoundaryPoints = BoundaryPtr; 57 Log() << Verbose( 0) << "Using given boundary points set." << endl;55 Log() << Verbose(1) << "Using given boundary points set." << endl; 58 56 } 59 57 // determine biggest "diameter" of cluster for each axis … … 69 67 //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl; 70 68 for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 71 //Log() << Verbose( 1) << "Current runner is " << *(runner->second.second) << "." << endl;69 //Log() << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl; 72 70 // seek for the neighbours pair where the Othercomponent sign flips 73 71 Neighbour = runner; … … 84 82 DistanceVector.CopyVector(&runner->second.second->x); 85 83 DistanceVector.SubtractVector(&Neighbour->second.second->x); 86 //Log() << Verbose( 2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;84 //Log() << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl; 87 85 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 88 86 OldComponent) - DistanceVector.x[Othercomponent] / fabs( … … 93 91 OtherNeighbour = BoundaryPoints[axis].end(); 94 92 OtherNeighbour--; 95 //Log() << Verbose( 1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;93 //Log() << Verbose(2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl; 96 94 // now we have found the pair: Neighbour and OtherNeighbour 97 95 OtherVector.CopyVector(&runner->second.second->x); 98 96 OtherVector.SubtractVector(&OtherNeighbour->second.second->x); 99 //Log() << Verbose( 1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;100 //Log() << Verbose( 1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;97 //Log() << Verbose(2) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl; 98 //Log() << Verbose(2) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl; 101 99 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 102 100 w1 = fabs(OtherVector.x[Othercomponent]); … … 105 103 * OtherVector.x[component]) / (w1 + w2)); 106 104 // mark if it has greater diameter 107 //Log() << Verbose( 1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;105 //Log() << Verbose(2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl; 108 106 GreatestDiameter[component] = (GreatestDiameter[component] 109 107 > tmp) ? GreatestDiameter[component] : tmp; 110 108 } //else 111 //Log() << Verbose( 1) << "Saw no sign flip, probably top or bottom node." << endl;109 //Log() << Verbose(2) << "Saw no sign flip, probably top or bottom node." << endl; 112 110 } 113 111 } … … 137 135 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct) 138 136 { 139 Info FunctionInfo(__func__);140 137 atom *Walker = NULL; 141 138 PointMap PointsOnBoundary; … … 152 149 double angle = 0.; 153 150 151 Log() << Verbose(1) << "Finding all boundary points." << endl; 154 152 // 3a. Go through every axis 155 153 for (int axis = 0; axis < NDIM; axis++) { … … 178 176 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 179 177 180 //Log() << Verbose( 1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;178 //Log() << Verbose(2) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl; 181 179 if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) { 182 180 angle = 2. * M_PI - angle; 183 181 } 184 Log() << Verbose( 1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;182 Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl; 185 183 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker))); 186 184 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity … … 212 210 // printing all inserted for debugging 213 211 // { 214 // Log() << Verbose( 1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;212 // Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 215 213 // int i=0; 216 214 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 217 215 // if (runner != BoundaryPoints[axis].begin()) 218 // Log() << Verbose( 0) << ", " << i << ": " << *runner->second.second;216 // Log() << Verbose(2) << ", " << i << ": " << *runner->second.second; 219 217 // else 220 // Log() << Verbose( 0) << i << ": " << *runner->second.second;218 // Log() << Verbose(2) << i << ": " << *runner->second.second; 221 219 // i++; 222 220 // } 223 // Log() << Verbose( 0) << endl;221 // Log() << Verbose(2) << endl; 224 222 // } 225 223 // 3c. throw out points whose distance is less than the mean of left and right neighbours … … 251 249 SideA.SubtractVector(MolCenter); 252 250 SideA.ProjectOntoPlane(&AxisVector); 253 // Log() << Verbose( 1) << "SideA: " << SideA << endl;251 // Log() << Verbose(0) << "SideA: " << SideA << endl; 254 252 255 253 SideB.CopyVector(&right->second.second->x); 256 254 SideB.SubtractVector(MolCenter); 257 255 SideB.ProjectOntoPlane(&AxisVector); 258 // Log() << Verbose( 1) << "SideB: " << SideB << endl;256 // Log() << Verbose(0) << "SideB: " << SideB << endl; 259 257 260 258 SideC.CopyVector(&left->second.second->x); 261 259 SideC.SubtractVector(&right->second.second->x); 262 260 SideC.ProjectOntoPlane(&AxisVector); 263 // Log() << Verbose( 1) << "SideC: " << SideC << endl;261 // Log() << Verbose(0) << "SideC: " << SideC << endl; 264 262 265 263 SideH.CopyVector(&runner->second.second->x); 266 264 SideH.SubtractVector(MolCenter); 267 265 SideH.ProjectOntoPlane(&AxisVector); 268 // Log() << Verbose( 1) << "SideH: " << SideH << endl;266 // Log() << Verbose(0) << "SideH: " << SideH << endl; 269 267 270 268 // calculate each length … … 279 277 const double delta = SideC.Angle(&SideH); 280 278 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 281 //Log() << Verbose( 1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;279 //Log() << Verbose(2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl; 282 280 Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl; 283 281 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { … … 305 303 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 306 304 { 307 Info FunctionInfo(__func__);308 305 bool BoundaryFreeFlag = false; 309 306 Boundaries *BoundaryPoints = NULL; 307 308 Log() << Verbose(1) << "Begin of FindConvexBorder" << endl; 310 309 311 310 if (TesselStruct != NULL) // free if allocated … … 318 317 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 319 318 } else { 320 Log() << Verbose( 0) << "Using given boundary points set." << endl;319 Log() << Verbose(1) << "Using given boundary points set." << endl; 321 320 } 322 321 … … 324 323 for (int axis=0; axis < NDIM; axis++) 325 324 { 326 Log() << Verbose( 1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;325 Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 327 326 int i=0; 328 327 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 329 328 if (runner != BoundaryPoints[axis].begin()) 330 Log() << Verbose( 0) << ", " << i << ": " << *runner->second.second;329 Log() << Verbose(2) << ", " << i << ": " << *runner->second.second; 331 330 else 332 Log() << Verbose( 0) << i << ": " << *runner->second.second;331 Log() << Verbose(2) << i << ": " << *runner->second.second; 333 332 i++; 334 333 } 335 Log() << Verbose( 0) << endl;334 Log() << Verbose(2) << endl; 336 335 } 337 336 … … 342 341 eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl; 343 342 344 Log() << Verbose( 0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;343 Log() << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl; 345 344 // now we have the whole set of edge points in the BoundaryList 346 345 … … 348 347 // Log() << Verbose(1) << "Listing PointsOnBoundary:"; 349 348 // for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) { 350 // Log() << Verbose( 0) << " " << *runner->second;349 // Log() << Verbose(1) << " " << *runner->second; 351 350 // } 352 // Log() << Verbose( 0) << endl;351 // Log() << Verbose(1) << endl; 353 352 354 353 // 3a. guess starting triangle … … 360 359 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 361 360 if (!TesselStruct->InsertStraddlingPoints(mol, LCList)) 362 eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl;363 364 Log() << Verbose( 0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;361 Log() << Verbose(1) << "Insertion of straddling points failed!" << endl; 362 363 Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 365 364 366 365 // 4. Store triangles in tecplot file … … 412 411 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 413 412 414 Log() << Verbose( 0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;413 Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 415 414 416 415 // 4. Store triangles in tecplot file … … 438 437 if (BoundaryFreeFlag) 439 438 delete[] (BoundaryPoints); 439 440 Log() << Verbose(1) << "End of FindConvexBorder" << endl; 440 441 }; 441 442 … … 449 450 bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 450 451 { 451 Info FunctionInfo(__func__);452 452 int i=0; 453 453 char number[MAXSTRINGSIZE]; … … 460 460 PointMap::iterator PointRunner; 461 461 while (!TesselStruct->PointsOnBoundary.empty()) { 462 Log() << Verbose( 1) << "Remaining points are: ";462 Log() << Verbose(2) << "Remaining points are: "; 463 463 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 464 Log() << Verbose( 0) << *(PointSprinter->second) << "\t";465 Log() << Verbose( 0) << endl;464 Log() << Verbose(2) << *(PointSprinter->second) << "\t"; 465 Log() << Verbose(2) << endl; 466 466 467 467 PointRunner = TesselStruct->PointsOnBoundary.begin(); … … 503 503 double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 504 504 { 505 Info FunctionInfo(__func__);506 505 double volume = 0; 507 506 class BoundaryPointSet *point = NULL; … … 517 516 int run = 0; 518 517 518 Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl; 519 519 520 // check whether there is something to work on 520 521 if (TesselStruct == NULL) { … … 538 539 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 539 540 line = LineRunner->second; 540 Log() << Verbose( 1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;541 Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 541 542 if (!line->CheckConvexityCriterion()) { 542 543 // remove the point if needed … … 603 604 604 605 // end 605 Log() << Verbose(0) << "Volume is " << volume << "." << endl; 606 Log() << Verbose(1) << "Volume is " << volume << "." << endl; 607 Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl; 606 608 return volume; 607 609 }; … … 617 619 double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration) 618 620 { 619 Info FunctionInfo(__func__);620 621 bool IsAngstroem = configuration->GetIsAngstroem(); 621 622 double volume = 0.; … … 624 625 625 626 // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes 627 Log() << Verbose(1) 628 << "Calculating the volume of the pyramids formed out of triangles and center of gravity." 629 << endl; 626 630 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 627 631 { // go through every triangle, calculate volume of its pyramid with CoG as peak … … 638 642 const double h = x.Norm(); // distance of CoG to triangle 639 643 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 640 Log() << Verbose( 1) << "Area of triangle is " << setprecision(10) << G << " "644 Log() << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " " 641 645 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 642 646 << h << " and the volume is " << PyramidVolume << " " … … 660 664 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 661 665 { 662 Info FunctionInfo(__func__);663 666 // 4. Store triangles in tecplot file 664 667 if (filename != NULL) { … … 668 671 OutputName.append(TecplotSuffix); 669 672 ofstream *tecplot = new ofstream(OutputName.c_str()); 670 WriteTecplotFile(tecplot, TesselStruct, mol, -1);673 WriteTecplotFile(tecplot, TesselStruct, mol, 0); 671 674 tecplot->close(); 672 675 delete(tecplot); … … 695 698 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity) 696 699 { 697 Info FunctionInfo(__func__);698 700 bool IsAngstroem = true; 699 701 double *GreatestDiameter = NULL; … … 796 798 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation) 797 799 { 798 Info FunctionInfo(__func__);799 800 molecule *Filling = new molecule(filler->elemente); 800 801 Vector CurrentPosition; … … 813 814 double phi[NDIM]; 814 815 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 816 817 Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl; 815 818 816 819 i=0; … … 874 877 for (int i=0;i<NDIM;i++) 875 878 FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 876 Log() << Verbose( 2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;879 Log() << Verbose(3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl; 877 880 878 881 // go through all atoms … … 935 938 delete(TesselStruct[i]); 936 939 } 940 Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl; 941 937 942 return Filling; 938 943 }; … … 946 951 * \param RADIUS radius of the virtual sphere 947 952 * \param *filename filename prefix for output of vertex data 948 * \return true - tesselation successful, false - tesselation failed 949 */ 950 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 953 */ 954 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 951 955 { 952 Info FunctionInfo(__func__);953 956 bool freeLC = false; 954 bool status = false; 955 CandidateForTesselation *baseline; 957 LineMap::iterator baseline; 956 958 LineMap::iterator testline; 957 bool OneLoopWithoutSuccessFlag = true; // marks whether we went once through all baselines without finding any without two triangles959 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles 958 960 bool TesselationFailFlag = false; 959 BoundaryTriangleSet *T = NULL; 960 961 962 Log() << Verbose(1) << "Entering search for non convex hull. " << endl; 961 963 if (TesselStruct == NULL) { 962 964 Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl; … … 968 970 } 969 971 972 Log() << Verbose(0) << "Begin of FindNonConvexBorder\n"; 973 970 974 // initialise Linked Cell 971 975 if (LCList == NULL) { … … 978 982 979 983 // 2. expand from there 980 while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) { 981 // 2a. fill all new OpenLines 982 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl; 983 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 984 Log() << Verbose(2) << *(Runner->second) << endl; 985 986 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 987 baseline = Runner->second; 988 if (baseline->pointlist.empty()) { 989 T = (((baseline->BaseLine->triangles.begin()))->second); 990 Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl; 991 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 984 baseline = TesselStruct->LinesOnBoundary.begin(); 985 baseline++; // skip first line 986 while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 987 if (baseline->second->triangles.size() == 1) { 988 CheckListOfBaselines(TesselStruct); 989 // 3. find next triangle 990 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 991 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 992 if (!TesselationFailFlag) 993 eLog() << Verbose(2) << "FindNextSuitableTriangle failed." << endl; 994 995 // write temporary envelope 996 if (filename != NULL) { 997 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 998 TesselStruct->Output(filename, mol); 999 } 992 1000 } 993 } 994 995 // 2b. search for smallest ShortestAngle among all candidates 996 double ShortestAngle = 4.*M_PI; 997 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl; 998 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 999 Log() << Verbose(2) << *(Runner->second) << endl; 1000 1001 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 1002 if (Runner->second->ShortestAngle < ShortestAngle) { 1003 baseline = Runner->second; 1004 ShortestAngle = baseline->ShortestAngle; 1005 //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl; 1001 if (TesselationFailFlag) { 1002 baseline = TesselStruct->LinesOnBoundary.begin(); 1003 OneLoopWithoutSuccessFlag = false; 1004 Log() << Verbose(2) << "Baseline set to begin." << endl; 1006 1005 } 1007 } 1008 if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty())) 1006 } else { 1007 //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; 1008 if (baseline->second->triangles.size() != 2) { 1009 eLog() << Verbose(0) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl; 1010 performCriticalExit(); 1011 } 1012 } 1013 1014 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1015 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 1009 1016 OneLoopWithoutSuccessFlag = false; 1010 else { 1011 TesselStruct->AddCandidateTriangle(*baseline); 1012 } 1013 1014 // write temporary envelope 1015 if (filename != NULL) { 1016 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1017 TesselStruct->Output(filename, mol); 1018 } 1019 } 1020 } 1021 // // check envelope for consistency 1022 // status = CheckListOfBaselines(TesselStruct); 1023 // 1024 // // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1025 // //->InsertStraddlingPoints(mol, LCList); 1017 } 1018 baseline++; 1019 } 1020 // check envelope for consistency 1021 CheckListOfBaselines(TesselStruct); 1022 1023 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1024 //->InsertStraddlingPoints(mol, LCList); 1026 1025 // mol->GoToFirst(); 1027 1026 // class TesselPoint *Runner = NULL; … … 1038 1037 // } 1039 1038 1040 //// Purges surplus triangles.1041 //TesselStruct->RemoveDegeneratedTriangles();1039 // Purges surplus triangles. 1040 TesselStruct->RemoveDegeneratedTriangles(); 1042 1041 1043 1042 // check envelope for consistency 1044 status = CheckListOfBaselines(TesselStruct); 1045 1046 // store before correction 1047 StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, ""); 1048 1049 // correct degenerated polygons 1050 TesselStruct->CorrectAllDegeneratedPolygons(); 1051 1052 // check envelope for consistency 1053 status = CheckListOfBaselines(TesselStruct); 1043 CheckListOfBaselines(TesselStruct); 1054 1044 1055 1045 // write final envelope … … 1059 1049 if (freeLC) 1060 1050 delete(LCList); 1061 1062 return status; 1051 Log() << Verbose(0) << "End of FindNonConvexBorder\n"; 1063 1052 }; 1064 1053 … … 1072 1061 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol) 1073 1062 { 1074 Info FunctionInfo(__func__);1075 1063 Vector *Center = new Vector; 1076 1064 Center->Zero(); -
src/boundary.hpp
r0b2dd2 r482373 35 35 36 36 #define DEBUG 1 37 #define DoSingleStepOutput 038 #define SingleStepWidth 1 037 #define DoSingleStepOutput 1 38 #define SingleStepWidth 1 39 39 40 40 #define DistancePair pair < double, atom* > … … 53 53 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol); 54 54 void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC); 55 boolFindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);55 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename); 56 56 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct); 57 57 double * GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem); -
src/builder.cpp
r0b2dd2 r482373 65 65 #include "molecule.hpp" 66 66 #include "periodentafel.hpp" 67 #include "version.h"68 67 69 68 /********************************************* Subsubmenu routine ************************************/ … … 1248 1247 ofstream output; 1249 1248 molecule *mol = new molecule(periode); 1250 mol->SetNameFromFilename(ConfigFileName);1251 1249 1252 1250 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { … … 1387 1385 int argptr; 1388 1386 molecule *mol = NULL; 1389 string BondGraphFileName(" \n");1387 string BondGraphFileName(""); 1390 1388 int verbosity = 0; 1391 1389 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1); … … 1541 1539 mol = new molecule(periode); 1542 1540 mol->ActiveFlag = true; 1543 if (ConfigFileName != NULL)1544 mol->SetNameFromFilename(ConfigFileName);1545 1541 molecules->insert(mol); 1546 }1547 if (configuration.BG == NULL) {1548 configuration.BG = new BondGraph(configuration.GetIsAngstroem());1549 if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {1550 Log() << Verbose(0) << "Bond length table loaded successfully." << endl;1551 } else {1552 eLog() << Verbose(1) << "Bond length table loading failed." << endl;1553 }1554 1542 } 1555 1543 … … 1575 1563 else { 1576 1564 Log() << Verbose(2) << "File found and parsed." << endl; 1577 // @TODO rather do the dissection afterwards1578 // mol->SetNameFromFilename(argv[argptr]);1579 // molecules->ListOfMolecules.remove(mol);1580 // molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);1581 // delete(mol);1582 // if (molecules->ListOfMolecules.size() != 0) {1583 // for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)1584 // if ((*ListRunner)->ActiveFlag) {1585 // mol = *ListRunner;1586 // break;1587 // }1588 // }1589 1565 configPresent = present; 1590 1566 } … … 1805 1781 start = clock(); 1806 1782 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); 1807 if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1])) 1808 ExitFlag = 255; 1783 FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]); 1809 1784 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1810 1785 end = clock(); 1811 1786 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 1812 1787 delete(LCList); 1813 delete(T);1814 1788 argptr+=2; 1815 1789 } … … 2223 2197 int j; 2224 2198 2225 cout << ESPACKVersion << endl;2226 2227 2199 setVerbosity(0); 2228 2200 -
src/config.cpp
r0b2dd2 r482373 140 140 void ConfigFileBuffer::MapIonTypesInBuffer(const int NoAtoms) 141 141 { 142 map<const char *, int, IonTypeCompare> IonTypeLineMap;142 map<const char *, int, IonTypeCompare> LineList; 143 143 if (LineMapping == NULL) { 144 144 eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl; … … 149 149 // put all into hashed map 150 150 for (int i=0; i<NoAtoms; ++i) { 151 IonTypeLineMap.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i));151 LineList.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i)); 152 152 } 153 153 154 154 // fill map 155 155 int nr=0; 156 for (map<const char *, int, IonTypeCompare>::iterator runner = IonTypeLineMap.begin(); runner != IonTypeLineMap.end(); ++runner) {156 for (map<const char *, int, IonTypeCompare>::iterator runner = LineList.begin(); runner != LineList.end(); ++runner) { 157 157 if (CurrentLine+nr < NoLines) 158 158 LineMapping[CurrentLine+(nr++)] = runner->second; … … 1056 1056 1057 1057 // 2. parse the bond graph file if given 1058 if (BG == NULL) { 1059 BG = new BondGraph(IsAngstroem); 1060 if (BG->LoadBondLengthTable(BondGraphFileName)) { 1061 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1062 } else { 1063 eLog() << Verbose(1) << "Bond length table loading failed." << endl; 1064 } 1058 BG = new BondGraph(IsAngstroem); 1059 if (BG->LoadBondLengthTable(BondGraphFileName)) { 1060 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1061 } else { 1062 Log() << Verbose(0) << "Bond length table loading failed." << endl; 1065 1063 } 1066 1064 1067 1065 // 3. parse the molecule in 1068 1066 LoadMolecule(mol, FileBuffer, periode, FastParsing); 1069 mol->SetNameFromFilename(filename);1070 1067 mol->ActiveFlag = true; 1071 MolList->insert(mol);1072 1068 1073 1069 // 4. dissect the molecule into connected subgraphs 1074 // don't do this here ... 1075 //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1076 //delete(mol); 1077 1070 MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1071 1072 delete(mol); 1078 1073 delete(FileBuffer); 1079 1074 }; -
src/errorlogger.cpp
r0b2dd2 r482373 82 82 l.nix->clear(); 83 83 if (v.DoOutput(verbosityLevel)) { 84 v.print(cout); 84 85 switch(v.Verbosity) { 85 86 case 0: 86 c err<< "CRITICAL: ";87 cout << "CRITICAL: "; 87 88 break; 88 89 case 1: 89 c err<< "ERROR: ";90 cout << "ERROR: "; 90 91 break; 91 92 case 2: 92 c err<< "WARNING: ";93 cout << "WARNING: "; 93 94 break; 94 95 default: 95 96 break; 96 97 } 97 v.print(cerr);98 98 return cerr; 99 99 } else … … 105 105 l->nix->clear(); 106 106 if (v.DoOutput(verbosityLevel)) { 107 v.print(cout); 107 108 switch(v.Verbosity) { 108 109 case 0: 109 c err<< "CRITICAL: ";110 cout << "CRITICAL: "; 110 111 break; 111 112 case 1: 112 c err<< "ERROR: ";113 cout << "ERROR: "; 113 114 break; 114 115 case 2: 115 c err<< "WARNING: ";116 cout << "WARNING: "; 116 117 break; 117 118 default: 118 119 break; 119 120 } 120 v.print(cerr);121 121 return cerr; 122 122 } else -
src/molecule.hpp
r0b2dd2 r482373 106 106 107 107 // re-definition of virtual functions from PointCloud 108 const char * const GetName() const;109 108 Vector *GetCenter() const ; 110 109 TesselPoint *GetPoint() const ; -
src/molecule_pointcloud.cpp
r0b2dd2 r482373 13 13 /************************************* Functions for class molecule *********************************/ 14 14 15 /** Returns a name for this point cloud, here the molecule's name.16 * \return name of point cloud17 */18 const char * const molecule::GetName() const19 {20 return name;21 };22 15 23 16 /** Determine center of all atoms. -
src/moleculelist.cpp
r0b2dd2 r482373 759 759 // 4a. create array of molecules to fill 760 760 const int MolCount = Subgraphs->next->Count(); 761 char number[MAXSTRINGSIZE];762 761 molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules"); 763 762 for (int i=0;i<MolCount;i++) { 764 763 molecules[i] = (molecule*) new molecule(mol->elemente); 765 764 molecules[i]->ActiveFlag = true; 766 strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);767 if (MolCount > 1) {768 sprintf(number, "-%d", i+1);769 strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);770 }771 cout << "MolName is " << molecules[i]->name << endl;772 765 insert(molecules[i]); 773 766 } … … 806 799 } 807 800 } 808 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list801 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds, but we have to remove them from first..last list 809 802 bond *Binder = mol->first; 810 803 while (mol->first->next != mol->last) { -
src/parser.cpp
r0b2dd2 r482373 158 158 //Log() << Verbose(0) << "Opening " << name << " ... " << input << endl; 159 159 if (input == NULL) { 160 eLog() << Verbose( 1) << endl << "Unable to open " << name << ", is the directory correct?" << endl;161 //performCriticalExit();160 eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl; 161 performCriticalExit(); 162 162 return false; 163 163 } -
src/tesselation.cpp
r0b2dd2 r482373 9 9 10 10 #include "helpers.hpp" 11 #include "info.hpp"12 11 #include "linkedcell.hpp" 13 12 #include "log.hpp" … … 23 22 /** Constructor of BoundaryPointSet. 24 23 */ 25 BoundaryPointSet::BoundaryPointSet() : 26 LinesCount(0), 27 value(0.), 28 Nr(-1) 29 { 30 Info FunctionInfo(__func__); 31 Log() << Verbose(1) << "Adding noname." << endl; 24 BoundaryPointSet::BoundaryPointSet() 25 { 26 LinesCount = 0; 27 Nr = -1; 28 value = 0.; 32 29 }; 33 30 … … 35 32 * \param *Walker TesselPoint this boundary point represents 36 33 */ 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; 34 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) 35 { 36 node = Walker; 37 LinesCount = 0; 38 Nr = Walker->nr; 39 value = 0.; 45 40 }; 46 41 … … 51 46 BoundaryPointSet::~BoundaryPointSet() 52 47 { 53 Info FunctionInfo(__func__); 54 //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl; 48 //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl; 55 49 if (!lines.empty()) 56 50 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl; … … 63 57 void BoundaryPointSet::AddLine(class BoundaryLineSet *line) 64 58 { 65 Info FunctionInfo(__func__); 66 Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." 59 Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "." 67 60 << endl; 68 61 if (line->endpoints[0] == this) … … 92 85 /** Constructor of BoundaryLineSet. 93 86 */ 94 BoundaryLineSet::BoundaryLineSet() : 95 Nr(-1) 96 { 97 Info FunctionInfo(__func__); 87 BoundaryLineSet::BoundaryLineSet() 88 { 98 89 for (int i = 0; i < 2; i++) 99 90 endpoints[i] = NULL; 91 Nr = -1; 100 92 }; 101 93 … … 107 99 BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number) 108 100 { 109 Info FunctionInfo(__func__);110 101 // set number 111 102 Nr = number; … … 115 106 Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding. 116 107 Point[1]->AddLine(this); // 117 // set skipped to false118 skipped = false;119 108 // clear triangles list 120 Log() << Verbose( 0) << "New Line with endpoints " << *this << "." << endl;109 Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl; 121 110 }; 122 111 … … 127 116 BoundaryLineSet::~BoundaryLineSet() 128 117 { 129 Info FunctionInfo(__func__);130 118 int Numbers[2]; 131 119 … … 146 134 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 147 135 if ((*Runner).second == this) { 148 //Log() << Verbose( 0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;136 //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 149 137 endpoints[i]->lines.erase(Runner); 150 138 break; … … 152 140 } else { // there's just a single line left 153 141 if (endpoints[i]->lines.erase(Nr)) { 154 //Log() << Verbose( 0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;142 //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 155 143 } 156 144 } 157 145 if (endpoints[i]->lines.empty()) { 158 //Log() << Verbose( 0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;146 //Log() << Verbose(5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl; 159 147 if (endpoints[i] != NULL) { 160 148 delete(endpoints[i]); … … 173 161 void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle) 174 162 { 175 Info FunctionInfo(__func__); 176 Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 163 Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 177 164 triangles.insert(TrianglePair(triangle->Nr, triangle)); 178 165 }; … … 184 171 bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line) 185 172 { 186 Info FunctionInfo(__func__);187 173 if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1])) 188 174 return true; … … 199 185 bool BoundaryLineSet::CheckConvexityCriterion() 200 186 { 201 Info FunctionInfo(__func__);202 187 Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck; 203 188 // get the two triangles 204 189 if (triangles.size() != 2) { 205 eLog() << Verbose( 0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;190 eLog() << Verbose(1) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl; 206 191 return true; 207 192 } 208 193 // check normal vectors 209 194 // have a normal vector on the base line pointing outwards 210 //Log() << Verbose( 0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;195 //Log() << Verbose(3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl; 211 196 BaseLineCenter.CopyVector(endpoints[0]->node->node); 212 197 BaseLineCenter.AddVector(endpoints[1]->node->node); … … 214 199 BaseLine.CopyVector(endpoints[0]->node->node); 215 200 BaseLine.SubtractVector(endpoints[1]->node->node); 216 //Log() << Verbose( 0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;201 //Log() << Verbose(3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl; 217 202 218 203 BaseLineNormal.Zero(); … … 222 207 class BoundaryPointSet *node = NULL; 223 208 for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) { 224 //Log() << Verbose( 0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;209 //Log() << Verbose(3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl; 225 210 NormalCheck.AddVector(&runner->second->NormalVector); 226 211 NormalCheck.Scale(sign); … … 229 214 BaseLineNormal.CopyVector(&runner->second->NormalVector); // yes, copy second on top of first 230 215 else { 231 eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl; 216 Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl; 217 exit(255); 232 218 } 233 219 node = runner->second->GetThirdEndpoint(this); 234 220 if (node != NULL) { 235 //Log() << Verbose( 0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;221 //Log() << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl; 236 222 helper[i].CopyVector(node->node->node); 237 223 helper[i].SubtractVector(&BaseLineCenter); 238 224 helper[i].MakeNormalVector(&BaseLine); // we want to compare the triangle's heights' angles! 239 //Log() << Verbose( 0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;225 //Log() << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl; 240 226 i++; 241 227 } else { 242 eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;228 //eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl; 243 229 return true; 244 230 } 245 231 } 246 //Log() << Verbose( 0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;232 //Log() << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl; 247 233 if (NormalCheck.NormSquared() < MYEPSILON) { 248 Log() << Verbose( 0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;234 Log() << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl; 249 235 return true; 250 236 } … … 252 238 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 253 239 if ((angle - M_PI) > -MYEPSILON) { 254 Log() << Verbose( 0) << "ACCEPT: Angle is greater than pi: convex." << endl;240 Log() << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl; 255 241 return true; 256 242 } else { 257 Log() << Verbose( 0) << "REJECT: Angle is less than pi: concave." << endl;243 Log() << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl; 258 244 return false; 259 245 } … … 266 252 bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 267 253 { 268 Info FunctionInfo(__func__);269 254 for(int i=0;i<2;i++) 270 255 if (point == endpoints[i]) … … 279 264 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point) 280 265 { 281 Info FunctionInfo(__func__);282 266 if (endpoints[0] == point) 283 267 return endpoints[1]; … … 302 286 /** Constructor for BoundaryTriangleSet. 303 287 */ 304 BoundaryTriangleSet::BoundaryTriangleSet() : 305 Nr(-1) 306 { 307 Info FunctionInfo(__func__); 288 BoundaryTriangleSet::BoundaryTriangleSet() 289 { 308 290 for (int i = 0; i < 3; i++) 309 291 { … … 311 293 lines[i] = NULL; 312 294 } 295 Nr = -1; 313 296 }; 314 297 … … 317 300 * \param number number of triangle 318 301 */ 319 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) : 320 Nr(number) 321 { 322 Info FunctionInfo(__func__); 302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) 303 { 323 304 // set number 305 Nr = number; 324 306 // set lines 325 for (int i = 0; i < 3; i++) { 326 lines[i] = line[i]; 327 lines[i]->AddTriangle(this); 328 } 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 } 329 313 // get ascending order of endpoints 330 PointMapOrderMap;314 map<int, class BoundaryPointSet *> OrderMap; 331 315 for (int i = 0; i < 3; i++) 332 316 // for all three lines 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 } 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 } 338 323 // set endpoints 339 324 int Counter = 0; 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 } 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!" << endl; 336 performCriticalExit(); 337 } 338 Log() << Verbose(0) << "." << endl; 350 339 }; 351 340 … … 356 345 BoundaryTriangleSet::~BoundaryTriangleSet() 357 346 { 358 Info FunctionInfo(__func__);359 347 for (int i = 0; i < 3; i++) { 360 348 if (lines[i] != NULL) { 361 349 if (lines[i]->triangles.erase(Nr)) { 362 //Log() << Verbose( 0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;350 //Log() << Verbose(5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl; 363 351 } 364 352 if (lines[i]->triangles.empty()) { 365 //Log() << Verbose( 0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;353 //Log() << Verbose(5) << *lines[i] << " is no more attached to any triangle, erasing." << endl; 366 354 delete (lines[i]); 367 355 lines[i] = NULL; … … 369 357 } 370 358 } 371 //Log() << Verbose( 0) << "Erasing triangle Nr." << Nr << " itself." << endl;359 //Log() << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl; 372 360 }; 373 361 … … 378 366 void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector) 379 367 { 380 Info FunctionInfo(__func__);381 368 // get normal vector 382 369 NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node); … … 385 372 if (NormalVector.ScalarProduct(&OtherVector) > 0.) 386 373 NormalVector.Scale(-1.); 387 Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;388 374 }; 389 375 … … 402 388 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection) 403 389 { 404 Info FunctionInfo(__func__);405 390 Vector CrossPoint; 406 391 Vector helper; 407 392 408 393 if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) { 409 eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;394 Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl; 410 395 return false; 411 396 } … … 423 408 } while (CrossPoint.NormSquared() < MYEPSILON); 424 409 if (i==3) { 425 eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl; 410 eLog() << Verbose(1) << "Could not find any cross points, something's utterly wrong here!" << endl; 411 exit(255); 426 412 } 427 413 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 442 428 bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line) 443 429 { 444 Info FunctionInfo(__func__);445 430 for(int i=0;i<3;i++) 446 431 if (line == lines[i]) … … 455 440 bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 456 441 { 457 Info FunctionInfo(__func__);458 442 for(int i=0;i<3;i++) 459 443 if (point == endpoints[i]) … … 468 452 bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point) 469 453 { 470 Info FunctionInfo(__func__);471 454 for(int i=0;i<3;i++) 472 455 if (point == endpoints[i]->node) … … 481 464 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3]) 482 465 { 483 Info FunctionInfo(__func__);484 466 return (((endpoints[0] == Points[0]) 485 467 || (endpoints[0] == Points[1]) … … 503 485 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T) 504 486 { 505 Info FunctionInfo(__func__);506 487 return (((endpoints[0] == T->endpoints[0]) 507 488 || (endpoints[0] == T->endpoints[1]) … … 525 506 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line) 526 507 { 527 Info FunctionInfo(__func__);528 508 // sanity check 529 509 if (!ContainsBoundaryLine(line)) … … 542 522 void BoundaryTriangleSet::GetCenter(Vector *center) 543 523 { 544 Info FunctionInfo(__func__);545 524 center->Zero(); 546 525 for(int i=0;i<3;i++) … … 555 534 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a) 556 535 { 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 << "]"; 536 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 537 << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]"; 560 538 return ost; 561 539 }; 562 540 563 // ======================================== Polygons on Boundary =================================564 565 /** Constructor for BoundaryPolygonSet.566 */567 BoundaryPolygonSet::BoundaryPolygonSet() :568 Nr(-1)569 {570 Info FunctionInfo(__func__);571 };572 573 /** Destructor of BoundaryPolygonSet.574 * Just clears endpoints.575 * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()576 */577 BoundaryPolygonSet::~BoundaryPolygonSet()578 {579 Info FunctionInfo(__func__);580 endpoints.clear();581 Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl;582 };583 584 /** Calculates the normal vector for this triangle.585 * Is made unique by comparison with \a OtherVector to point in the other direction.586 * \param &OtherVector direction vector to make normal vector unique.587 * \return allocated vector in normal direction588 */589 Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const590 {591 Info FunctionInfo(__func__);592 // get normal vector593 Vector TemporaryNormal;594 Vector *TotalNormal = new Vector;595 PointSet::const_iterator Runner[3];596 for (int i=0;i<3; i++) {597 Runner[i] = endpoints.begin();598 for (int j = 0; j<i; j++) { // go as much further599 Runner[i]++;600 if (Runner[i] == endpoints.end()) {601 eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl;602 performCriticalExit();603 }604 }605 }606 TotalNormal->Zero();607 int counter=0;608 for (; Runner[2] != endpoints.end(); ) {609 TemporaryNormal.MakeNormalVector((*Runner[0])->node->node, (*Runner[1])->node->node, (*Runner[2])->node->node);610 for (int i=0;i<3;i++) // increase each of them611 Runner[i]++;612 TotalNormal->AddVector(&TemporaryNormal);613 }614 TotalNormal->Scale(1./(double)counter);615 616 // make it always point inward (any offset vector onto plane projected onto normal vector suffices)617 if (TotalNormal->ScalarProduct(&OtherVector) > 0.)618 TotalNormal->Scale(-1.);619 Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl;620 621 return TotalNormal;622 };623 624 /** Calculates the center point of the triangle.625 * Is third of the sum of all endpoints.626 * \param *center central point on return.627 */628 void BoundaryPolygonSet::GetCenter(Vector * const center) const629 {630 Info FunctionInfo(__func__);631 center->Zero();632 int counter = 0;633 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {634 center->AddVector((*Runner)->node->node);635 counter++;636 }637 center->Scale(1./(double)counter);638 Log() << Verbose(1) << "Center is at " << *center << "." << endl;639 }640 641 /** Checks whether the polygons contains all three endpoints of the triangle.642 * \param *triangle triangle to test643 * \return true - triangle is contained polygon, false - is not644 */645 bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const646 {647 Info FunctionInfo(__func__);648 return ContainsPresentTupel(triangle->endpoints, 3);649 };650 651 /** Checks whether the polygons contains both endpoints of the line.652 * \param *line line to test653 * \return true - line is of the triangle, false - is not654 */655 bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const656 {657 Info FunctionInfo(__func__);658 return ContainsPresentTupel(line->endpoints, 2);659 };660 661 /** Checks whether point is any of the three endpoints this triangle contains.662 * \param *point point to test663 * \return true - point is of the triangle, false - is not664 */665 bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const666 {667 Info FunctionInfo(__func__);668 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {669 Log() << Verbose(0) << "Checking against " << **Runner << endl;670 if (point == (*Runner)) {671 Log() << Verbose(0) << " Contained." << endl;672 return true;673 }674 }675 Log() << Verbose(0) << " Not contained." << endl;676 return false;677 };678 679 /** Checks whether point is any of the three endpoints this triangle contains.680 * \param *point TesselPoint to test681 * \return true - point is of the triangle, false - is not682 */683 bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const684 {685 Info FunctionInfo(__func__);686 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)687 if (point == (*Runner)->node) {688 Log() << Verbose(0) << " Contained." << endl;689 return true;690 }691 Log() << Verbose(0) << " Not contained." << endl;692 return false;693 };694 695 /** Checks whether given array of \a *Points coincide with polygons's endpoints.696 * \param **Points pointer to an array of BoundaryPointSet697 * \param dim dimension of array698 * \return true - set of points is contained in polygon, false - is not699 */700 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const701 {702 Info FunctionInfo(__func__);703 int counter = 0;704 Log() << Verbose(1) << "Polygon is " << *this << endl;705 for(int i=0;i<dim;i++) {706 Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl;707 if (ContainsBoundaryPoint(Points[i])) {708 counter++;709 }710 }711 712 if (counter == dim)713 return true;714 else715 return false;716 };717 718 /** Checks whether given PointList coincide with polygons's endpoints.719 * \param &endpoints PointList720 * \return true - set of points is contained in polygon, false - is not721 */722 bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const723 {724 Info FunctionInfo(__func__);725 size_t counter = 0;726 Log() << Verbose(1) << "Polygon is " << *this << endl;727 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {728 Log() << Verbose(1) << " Testing endpoint " << **Runner << endl;729 if (ContainsBoundaryPoint(*Runner))730 counter++;731 }732 733 if (counter == endpoints.size())734 return true;735 else736 return false;737 };738 739 /** Checks whether given set of \a *Points coincide with polygons's endpoints.740 * \param *P pointer to BoundaryPolygonSet741 * \return true - is the very triangle, false - is not742 */743 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const744 {745 return ContainsPresentTupel((const PointSet)P->endpoints);746 };747 748 /** Gathers all the endpoints' triangles in a unique set.749 * \return set of all triangles750 */751 TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const752 {753 Info FunctionInfo(__func__);754 pair <TriangleSet::iterator, bool> Tester;755 TriangleSet *triangles = new TriangleSet;756 757 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)758 for(LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)759 for(TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {760 //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;761 if (ContainsBoundaryTriangle(Sprinter->second)) {762 Tester = triangles->insert(Sprinter->second);763 if (Tester.second)764 Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl;765 }766 }767 768 Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl;769 return triangles;770 };771 772 /** Fills the endpoints of this polygon from the triangles attached to \a *line.773 * \param *line lines with triangles attached774 * \return true - polygon contains endpoints, false - line was NULL775 */776 bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)777 {778 Info FunctionInfo(__func__);779 pair <PointSet::iterator, bool> Tester;780 if (line == NULL)781 return false;782 Log() << Verbose(1) << "Filling polygon from line " << *line << endl;783 for(TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {784 for (int i=0;i<3;i++) {785 Tester = endpoints.insert((Runner->second)->endpoints[i]);786 if (Tester.second)787 Log() << Verbose(1) << " Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl;788 }789 }790 791 return true;792 };793 794 /** output operator for BoundaryPolygonSet.795 * \param &ost output stream796 * \param &a boundary polygon797 */798 ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)799 {800 ost << "[" << a.Nr << "|";801 for(PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {802 ost << (*Runner)->node->Name;803 Runner++;804 if (Runner != a.endpoints.end())805 ost << ",";806 }807 ost<< "]";808 return ost;809 };810 811 541 // =========================================================== class TESSELPOINT =========================================== 812 542 … … 815 545 TesselPoint::TesselPoint() 816 546 { 817 Info FunctionInfo(__func__);818 547 node = NULL; 819 548 nr = -1; … … 825 554 TesselPoint::~TesselPoint() 826 555 { 827 Info FunctionInfo(__func__);828 556 }; 829 557 … … 840 568 ostream & TesselPoint::operator << (ostream &ost) 841 569 { 842 Info FunctionInfo(__func__); 843 ost << "[" << (nr) << "|" << this << "]"; 570 ost << "[" << (Name) << "|" << this << "]"; 844 571 return ost; 845 572 }; … … 852 579 PointCloud::PointCloud() 853 580 { 854 Info FunctionInfo(__func__); 581 855 582 }; 856 583 … … 859 586 PointCloud::~PointCloud() 860 587 { 861 Info FunctionInfo(__func__); 588 862 589 }; 863 590 … … 866 593 /** Constructor of class CandidateForTesselation. 867 594 */ 868 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 869 BaseLine(line), 870 ShortestAngle(2.*M_PI), 871 OtherShortestAngle(2.*M_PI) 872 { 873 Info FunctionInfo(__func__); 874 }; 875 876 877 /** Constructor of class CandidateForTesselation. 878 */ 879 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 880 BaseLine(line), 881 IsDegenerated(false), 882 ShortestAngle(2.*M_PI), 883 OtherShortestAngle(2.*M_PI) 884 { 885 Info FunctionInfo(__func__); 595 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) { 596 point = candidate; 597 BaseLine = line; 886 598 OptCenter.CopyVector(&OptCandidateCenter); 887 599 OtherOptCenter.CopyVector(&OtherOptCandidateCenter); … … 891 603 */ 892 604 CandidateForTesselation::~CandidateForTesselation() { 605 point = NULL; 893 606 BaseLine = NULL; 894 607 }; 895 608 896 /** output operator for CandidateForTesselation.897 * \param &ost output stream898 * \param &a boundary line899 */900 ostream & operator <<(ostream &ost, const CandidateForTesselation &a)901 {902 ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";903 if (a.pointlist.empty())904 ost << "no candidate.";905 else {906 ost << "candidate";907 if (a.pointlist.size() != 1)908 ost << "s ";909 else910 ost << " ";911 for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)912 ost << *(*Runner) << " ";913 ost << " at angle " << (a.ShortestAngle)<< ".";914 }915 916 return ost;917 };918 919 920 609 // =========================================================== class TESSELATION =========================================== 921 610 922 611 /** Constructor of class Tesselation. 923 612 */ 924 Tesselation::Tesselation() : 925 PointsOnBoundaryCount(0), 926 LinesOnBoundaryCount(0), 927 TrianglesOnBoundaryCount(0), 928 LastTriangle(NULL), 929 TriangleFilesWritten(0), 930 InternalPointer(PointsOnBoundary.begin()) 931 { 932 Info FunctionInfo(__func__); 613 Tesselation::Tesselation() 614 { 615 PointsOnBoundaryCount = 0; 616 LinesOnBoundaryCount = 0; 617 TrianglesOnBoundaryCount = 0; 618 InternalPointer = PointsOnBoundary.begin(); 619 LastTriangle = NULL; 620 TriangleFilesWritten = 0; 933 621 } 934 622 ; … … 939 627 Tesselation::~Tesselation() 940 628 { 941 Info FunctionInfo(__func__); 942 Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl; 629 Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl; 943 630 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 944 631 if (runner->second != NULL) { … … 948 635 eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl; 949 636 } 950 Log() << Verbose( 0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;637 Log() << Verbose(1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl; 951 638 } 952 639 ; … … 957 644 Vector * Tesselation::GetCenter(ofstream *out) const 958 645 { 959 Info FunctionInfo(__func__);960 646 Vector *Center = new Vector(0.,0.,0.); 961 647 int num=0; … … 973 659 TesselPoint * Tesselation::GetPoint() const 974 660 { 975 Info FunctionInfo(__func__);976 661 return (InternalPointer->second->node); 977 662 }; … … 982 667 TesselPoint * Tesselation::GetTerminalPoint() const 983 668 { 984 Info FunctionInfo(__func__);985 669 PointMap::const_iterator Runner = PointsOnBoundary.end(); 986 670 Runner--; … … 993 677 void Tesselation::GoToNext() const 994 678 { 995 Info FunctionInfo(__func__);996 679 if (InternalPointer != PointsOnBoundary.end()) 997 680 InternalPointer++; … … 1003 686 void Tesselation::GoToPrevious() const 1004 687 { 1005 Info FunctionInfo(__func__);1006 688 if (InternalPointer != PointsOnBoundary.begin()) 1007 689 InternalPointer--; … … 1013 695 void Tesselation::GoToFirst() const 1014 696 { 1015 Info FunctionInfo(__func__);1016 697 InternalPointer = PointsOnBoundary.begin(); 1017 698 }; … … 1022 703 void Tesselation::GoToLast() const 1023 704 { 1024 Info FunctionInfo(__func__);1025 705 InternalPointer = PointsOnBoundary.end(); 1026 706 InternalPointer--; … … 1032 712 bool Tesselation::IsEmpty() const 1033 713 { 1034 Info FunctionInfo(__func__);1035 714 return (PointsOnBoundary.empty()); 1036 715 }; … … 1041 720 bool Tesselation::IsEnd() const 1042 721 { 1043 Info FunctionInfo(__func__);1044 722 return (InternalPointer == PointsOnBoundary.end()); 1045 723 }; … … 1054 732 Tesselation::GuessStartingTriangle() 1055 733 { 1056 Info FunctionInfo(__func__);1057 734 // 4b. create a starting triangle 1058 735 // 4b1. create all distances … … 1101 778 baseline->second.first->second->node->node, 1102 779 baseline->second.second->second->node->node); 1103 Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl; 780 Log() << Verbose(2) << "Plane vector of candidate triangle is "; 781 PlaneVector.Output(); 782 Log() << Verbose(0) << endl; 1104 783 // 4. loop over all points 1105 784 double sign = 0.; … … 1117 796 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 1118 797 continue; 1119 Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl; 798 Log() << Verbose(3) << "Projection of " << checker->second->node->Name 799 << " yields distance of " << distance << "." << endl; 1120 800 tmp = distance / fabs(distance); 1121 801 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) … … 1170 850 if (checker == PointsOnBoundary.end()) 1171 851 { 1172 Log() << Verbose( 2) << "Looks like we have a candidate!" << endl;852 Log() << Verbose(0) << "Looks like we have a candidate!" << endl; 1173 853 break; 1174 854 } … … 1200 880 else 1201 881 { 1202 eLog() << Verbose(0) << "No starting triangle found." << endl; 882 Log() << Verbose(1) << "No starting triangle found." << endl; 883 exit(255); 1203 884 } 1204 885 } … … 1220 901 void Tesselation::TesselateOnBoundary(const PointCloud * const cloud) 1221 902 { 1222 Info FunctionInfo(__func__);1223 903 bool flag; 1224 904 PointMap::iterator winner; … … 1239 919 // get peak point with respect to this base line's only triangle 1240 920 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 1241 Log() << Verbose( 0) << "Current baseline is between " << *(baseline->second) << "." << endl;921 Log() << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl; 1242 922 for (int i = 0; i < 3; i++) 1243 923 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 1244 924 peak = BTS->endpoints[i]; 1245 Log() << Verbose( 1) << " and has peak " << *peak << "." << endl;925 Log() << Verbose(3) << " and has peak " << *peak << "." << endl; 1246 926 1247 927 // prepare some auxiliary vectors … … 1258 938 CenterVector.AddVector(BTS->endpoints[i]->node->node); 1259 939 CenterVector.Scale(1. / 3.); 1260 Log() << Verbose( 2) << "CenterVector of base triangle is " << CenterVector << endl;940 Log() << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl; 1261 941 1262 942 // normal vector of triangle … … 1265 945 BTS->GetNormalVector(NormalVector); 1266 946 NormalVector.CopyVector(&BTS->NormalVector); 1267 Log() << Verbose( 2) << "NormalVector of base triangle is " << NormalVector << endl;947 Log() << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl; 1268 948 1269 949 // vector in propagation direction (out of triangle) … … 1272 952 TempVector.CopyVector(&CenterVector); 1273 953 TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 1274 //Log() << Verbose( 0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;954 //Log() << Verbose(2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl; 1275 955 if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline 1276 956 PropagationVector.Scale(-1.); 1277 Log() << Verbose( 2) << "PropagationVector of base triangle is " << PropagationVector << endl;957 Log() << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl; 1278 958 winner = PointsOnBoundary.end(); 1279 959 … … 1281 961 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 1282 962 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 1283 Log() << Verbose( 1) << "Target point is " << *(target->second) << ":" << endl;963 Log() << Verbose(3) << "Target point is " << *(target->second) << ":" << endl; 1284 964 1285 965 // first check direction, so that triangles don't intersect … … 1288 968 VirtualNormalVector.ProjectOntoPlane(&NormalVector); 1289 969 TempAngle = VirtualNormalVector.Angle(&PropagationVector); 1290 Log() << Verbose( 2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;970 Log() << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl; 1291 971 if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees) 1292 Log() << Verbose( 2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;972 Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl; 1293 973 continue; 1294 974 } else 1295 Log() << Verbose( 2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;975 Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl; 1296 976 1297 977 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 1299 979 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 1300 980 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 1301 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;981 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; 1302 982 continue; 1303 983 } 1304 984 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 1305 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;985 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; 1306 986 continue; 1307 987 } … … 1320 1000 helper.ProjectOntoPlane(&TempVector); 1321 1001 if (fabs(helper.NormSquared()) < MYEPSILON) { 1322 Log() << Verbose( 2) << "Chosen set of vectors is linear dependent." << endl;1002 Log() << Verbose(4) << "Chosen set of vectors is linear dependent." << endl; 1323 1003 continue; 1324 1004 } … … 1337 1017 // calculate angle 1338 1018 TempAngle = NormalVector.Angle(&VirtualNormalVector); 1339 Log() << Verbose( 2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;1019 Log() << Verbose(4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl; 1340 1020 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 1341 1021 SmallestAngle = TempAngle; 1342 1022 winner = target; 1343 Log() << Verbose( 2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1023 Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1344 1024 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 1345 1025 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 1359 1039 SmallestAngle = TempAngle; 1360 1040 winner = target; 1361 Log() << Verbose( 2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;1041 Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl; 1362 1042 } else 1363 Log() << Verbose( 2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;1043 Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl; 1364 1044 } else 1365 Log() << Verbose( 2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1045 Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1366 1046 } 1367 1047 } // end of loop over all boundary points … … 1369 1049 // 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 1370 1050 if (winner != PointsOnBoundary.end()) { 1371 Log() << Verbose( 0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;1051 Log() << Verbose(2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl; 1372 1052 // create the lins of not yet present 1373 1053 BLS[0] = baseline->second; … … 1399 1079 TrianglesOnBoundaryCount++; 1400 1080 } else { 1401 eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;1081 Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl; 1402 1082 } 1403 1083 1404 1084 // 5d. If the set of lines is not yet empty, go to 5. and continue 1405 1085 } else 1406 Log() << Verbose( 0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;1086 Log() << Verbose(2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl; 1407 1087 } while (flag); 1408 1088 … … 1419 1099 bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC) 1420 1100 { 1421 Info FunctionInfo(__func__);1422 1101 Vector Intersection, Normal; 1423 1102 TesselPoint *Walker = NULL; … … 1426 1105 bool AddFlag = false; 1427 1106 LinkedCell *BoundaryPoints = NULL; 1107 1108 Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl; 1428 1109 1429 1110 cloud->GoToFirst(); … … 1436 1117 } 1437 1118 Walker = cloud->GetPoint(); 1438 Log() << Verbose( 0) << "Current point is " << *Walker << "." << endl;1119 Log() << Verbose(2) << "Current point is " << *Walker << "." << endl; 1439 1120 // get the next triangle 1440 1121 triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints); 1441 1122 BTS = triangles->front(); 1442 1123 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1443 Log() << Verbose( 0) << "No triangles found, probably a tesselation point itself." << endl;1124 Log() << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl; 1444 1125 cloud->GoToNext(); 1445 1126 continue; 1446 1127 } else { 1447 1128 } 1448 Log() << Verbose( 0) << "Closest triangle is " << *BTS << "." << endl;1129 Log() << Verbose(2) << "Closest triangle is " << *BTS << "." << endl; 1449 1130 // get the intersection point 1450 1131 if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) { 1451 Log() << Verbose( 0) << "We have an intersection at " << Intersection << "." << endl;1132 Log() << Verbose(2) << "We have an intersection at " << Intersection << "." << endl; 1452 1133 // we have the intersection, check whether in- or outside of boundary 1453 1134 if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) { 1454 1135 // inside, next! 1455 Log() << Verbose( 0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;1136 Log() << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl; 1456 1137 } else { 1457 1138 // outside! 1458 Log() << Verbose( 0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;1139 Log() << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl; 1459 1140 class BoundaryLineSet *OldLines[3], *NewLines[3]; 1460 1141 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 1466 1147 Normal.CopyVector(&BTS->NormalVector); 1467 1148 // add Walker to boundary points 1468 Log() << Verbose( 0) << "Adding " << *Walker << " to BoundaryPoints." << endl;1149 Log() << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl; 1469 1150 AddFlag = true; 1470 1151 if (AddBoundaryPoint(Walker,0)) … … 1473 1154 continue; 1474 1155 // remove triangle 1475 Log() << Verbose( 0) << "Erasing triangle " << *BTS << "." << endl;1156 Log() << Verbose(2) << "Erasing triangle " << *BTS << "." << endl; 1476 1157 TrianglesOnBoundary.erase(BTS->Nr); 1477 1158 delete(BTS); … … 1481 1162 BPS[1] = OldPoints[i]; 1482 1163 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 1483 Log() << Verbose( 1) << "Creating new line " << *NewLines[i] << "." << endl;1164 Log() << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl; 1484 1165 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 1485 1166 LinesOnBoundaryCount++; … … 1492 1173 if (NewLines[j]->IsConnectedTo(BLS[0])) { 1493 1174 if (n>2) { 1494 eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl;1175 Log() << Verbose(1) << BLS[0] << " connects to all of the new lines?!" << endl; 1495 1176 return false; 1496 1177 } else … … 1503 1184 BTS->GetNormalVector(Normal); 1504 1185 Normal.Scale(-1.); 1505 Log() << Verbose( 0) << "Created new triangle " << *BTS << "." << endl;1186 Log() << Verbose(2) << "Created new triangle " << *BTS << "." << endl; 1506 1187 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1507 1188 TrianglesOnBoundaryCount++; … … 1517 1198 // exit 1518 1199 delete(Center); 1200 Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl; 1519 1201 return true; 1520 1202 }; … … 1527 1209 bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n) 1528 1210 { 1529 Info FunctionInfo(__func__);1530 1211 PointTestPair InsertUnique; 1531 1212 BPS[n] = new class BoundaryPointSet(Walker); … … 1549 1230 void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n) 1550 1231 { 1551 Info FunctionInfo(__func__);1552 1232 PointTestPair InsertUnique; 1553 1233 TPS[n] = new class BoundaryPointSet(Candidate); … … 1557 1237 } else { 1558 1238 delete TPS[n]; 1559 Log() << Verbose( 0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;1239 Log() << Verbose(4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl; 1560 1240 TPS[n] = (InsertUnique.first)->second; 1561 1241 } … … 1570 1250 void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const 1571 1251 { 1572 Info FunctionInfo(__func__);1573 1252 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr); 1574 1253 if (FindPoint != PointsOnBoundary.end()) … … 1588 1267 bool insertNewLine = true; 1589 1268 1590 LineMap::iterator FindLine = a->lines.find(b->node->nr); 1591 if (FindLine != a->lines.end()) { 1592 Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl; 1593 1269 if (a->lines.find(b->node->nr) != a->lines.end()) { 1270 LineMap::iterator FindLine = a->lines.find(b->node->nr); 1594 1271 pair<LineMap::iterator,LineMap::iterator> FindPair; 1595 1272 FindPair = a->lines.equal_range(b->node->nr); 1273 Log() << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl; 1596 1274 1597 1275 for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { … … 1599 1277 if (FindLine->second->triangles.size() < 2) { 1600 1278 insertNewLine = false; 1601 Log() << Verbose( 0) << "Using existing line " << *FindLine->second << endl;1279 Log() << Verbose(4) << "Using existing line " << *FindLine->second << endl; 1602 1280 1603 1281 BPS[0] = FindLine->second->endpoints[0]; 1604 1282 BPS[1] = FindLine->second->endpoints[1]; 1605 1283 BLS[n] = FindLine->second; 1606 1607 // remove existing line from OpenLines1608 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]);1609 if (CandidateLine != OpenLines.end()) {1610 Log() << Verbose(1) << " Removing line from OpenLines." << endl;1611 delete(CandidateLine->second);1612 OpenLines.erase(CandidateLine);1613 } else {1614 eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl;1615 }1616 1284 1617 1285 break; … … 1636 1304 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n) 1637 1305 { 1638 Info FunctionInfo(__func__); 1639 Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1306 Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1640 1307 BPS[0] = a; 1641 1308 BPS[1] = b; … … 1645 1312 // increase counter 1646 1313 LinesOnBoundaryCount++; 1647 // also add to open lines1648 CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]);1649 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT));1650 1314 }; 1651 1315 … … 1655 1319 void Tesselation::AddTesselationTriangle() 1656 1320 { 1657 Info FunctionInfo(__func__);1658 1321 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1659 1322 … … 1674 1337 void Tesselation::AddTesselationTriangle(const int nr) 1675 1338 { 1676 Info FunctionInfo(__func__); 1677 Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1339 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1678 1340 1679 1341 // add triangle to global map … … 1693 1355 void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle) 1694 1356 { 1695 Info FunctionInfo(__func__);1696 1357 if (triangle == NULL) 1697 1358 return; 1698 1359 for (int i = 0; i < 3; i++) { 1699 1360 if (triangle->lines[i] != NULL) { 1700 Log() << Verbose( 0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;1361 Log() << Verbose(5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl; 1701 1362 triangle->lines[i]->triangles.erase(triangle->Nr); 1702 1363 if (triangle->lines[i]->triangles.empty()) { 1703 Log() << Verbose( 0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;1364 Log() << Verbose(5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl; 1704 1365 RemoveTesselationLine(triangle->lines[i]); 1705 1366 } else { 1706 Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: "; 1707 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL)); 1367 Log() << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: "; 1708 1368 for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 1709 1369 Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 1710 1370 Log() << Verbose(0) << endl; 1711 1371 // for (int j=0;j<2;j++) { 1712 // Log() << Verbose( 0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";1372 // Log() << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 1713 1373 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 1714 1374 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1722 1382 1723 1383 if (TrianglesOnBoundary.erase(triangle->Nr)) 1724 Log() << Verbose( 0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;1384 Log() << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl; 1725 1385 delete(triangle); 1726 1386 }; … … 1732 1392 void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line) 1733 1393 { 1734 Info FunctionInfo(__func__);1735 1394 int Numbers[2]; 1736 1395 … … 1753 1412 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 1754 1413 if ((*Runner).second == line) { 1755 Log() << Verbose( 0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1414 Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1756 1415 line->endpoints[i]->lines.erase(Runner); 1757 1416 break; … … 1759 1418 } else { // there's just a single line left 1760 1419 if (line->endpoints[i]->lines.erase(line->Nr)) 1761 Log() << Verbose( 0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1420 Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1762 1421 } 1763 1422 if (line->endpoints[i]->lines.empty()) { 1764 Log() << Verbose( 0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;1423 Log() << Verbose(5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl; 1765 1424 RemoveTesselationPoint(line->endpoints[i]); 1766 1425 } else { 1767 Log() << Verbose( 0) << *line->endpoints[i] << " has still lines it's attached to: ";1426 Log() << Verbose(5) << *line->endpoints[i] << " has still lines it's attached to: "; 1768 1427 for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 1769 1428 Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1778 1437 1779 1438 if (LinesOnBoundary.erase(line->Nr)) 1780 Log() << Verbose( 0) << "Removing line Nr. " << line->Nr << "." << endl;1439 Log() << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl; 1781 1440 delete(line); 1782 1441 }; … … 1789 1448 void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point) 1790 1449 { 1791 Info FunctionInfo(__func__);1792 1450 if (point == NULL) 1793 1451 return; 1794 1452 if (PointsOnBoundary.erase(point->Nr)) 1795 Log() << Verbose( 0) << "Removing point Nr. " << point->Nr << "." << endl;1453 Log() << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl; 1796 1454 delete(point); 1797 1455 }; … … 1808 1466 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const 1809 1467 { 1810 Info FunctionInfo(__func__);1811 1468 int adjacentTriangleCount = 0; 1812 1469 class BoundaryPointSet *Points[3]; 1813 1470 1471 Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl; 1814 1472 // builds a triangle point set (Points) of the end points 1815 1473 for (int i = 0; i < 3; i++) { … … 1830 1488 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) { 1831 1489 TriangleMap *triangles = &FindLine->second->triangles; 1832 Log() << Verbose( 1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;1490 Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl; 1833 1491 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 1834 1492 if (FindTriangle->second->IsPresentTupel(Points)) { … … 1836 1494 } 1837 1495 } 1838 Log() << Verbose( 1) << "end." << endl;1496 Log() << Verbose(3) << "end." << endl; 1839 1497 } 1840 1498 // Only one of the triangle lines must be considered for the triangle count. 1841 //Log() << Verbose( 0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1499 //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1842 1500 //return adjacentTriangleCount; 1843 1501 } … … 1846 1504 } 1847 1505 1848 Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1506 Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1507 Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl; 1849 1508 return adjacentTriangleCount; 1850 1509 }; … … 1860 1519 class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3]) 1861 1520 { 1862 Info FunctionInfo(__func__);1863 1521 class BoundaryTriangleSet *triangle = NULL; 1864 1522 class BoundaryPointSet *Points[3]; … … 1890 1548 } 1891 1549 // Only one of the triangle lines must be considered for the triangle count. 1892 //Log() << Verbose( 0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1550 //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1893 1551 //return adjacentTriangleCount; 1894 1552 } … … 1911 1569 void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC) 1912 1570 { 1913 Info FunctionInfo(__func__);1571 Log() << Verbose(1) << "Begin of FindStartingTriangle\n"; 1914 1572 int i = 0; 1573 TesselPoint* FirstPoint = NULL; 1574 TesselPoint* SecondPoint = NULL; 1915 1575 TesselPoint* MaxPoint[NDIM]; 1916 TesselPoint* Temporary;1917 1576 double maxCoordinate[NDIM]; 1918 BoundaryLineSet BaseLine;1577 Vector Oben; 1919 1578 Vector helper; 1920 1579 Vector Chord; 1921 1580 Vector SearchDirection; 1922 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 1923 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in 1924 Vector SphereCenter; 1925 Vector NormalVector; 1926 1927 NormalVector.Zero(); 1581 1582 Oben.Zero(); 1928 1583 1929 1584 for (i = 0; i < 3; i++) { … … 1938 1593 for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) { 1939 1594 const LinkedNodes *List = LC->GetCurrentCell(); 1940 //Log() << Verbose( 1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1595 //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1941 1596 if (List != NULL) { 1942 1597 for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) { 1943 1598 if ((*Runner)->node->x[i] > maxCoordinate[i]) { 1944 Log() << Verbose( 1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;1599 Log() << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl; 1945 1600 maxCoordinate[i] = (*Runner)->node->x[i]; 1946 1601 MaxPoint[i] = (*Runner); … … 1953 1608 } 1954 1609 1955 Log() << Verbose( 1) << "Found maximum coordinates: ";1610 Log() << Verbose(2) << "Found maximum coordinates: "; 1956 1611 for (int i=0;i<NDIM;i++) 1957 1612 Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"; … … 1959 1614 1960 1615 BTS = NULL; 1616 CandidateList *OptCandidates = new CandidateList(); 1961 1617 for (int k=0;k<NDIM;k++) { 1962 NormalVector.Zero();1963 NormalVector.x[k] = 1.;1964 BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]);1965 Log() << Verbose( 0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;1618 Oben.Zero(); 1619 Oben.x[k] = 1.; 1620 FirstPoint = MaxPoint[k]; 1621 Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl; 1966 1622 1967 1623 double ShortestAngle; 1624 TesselPoint* OptCandidate = NULL; 1968 1625 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. 1969 1626 1970 FindSecondPointForTesselation(BaseLine.endpoints[0]->node, NormalVector, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1971 if (Temporary == NULL) // have we found a second point? 1627 FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1628 SecondPoint = OptCandidate; 1629 if (SecondPoint == NULL) // have we found a second point? 1972 1630 continue; 1973 BaseLine.endpoints[1] = new BoundaryPointSet(Temporary); 1974 1975 // construct center of circle1976 CircleCenter.CopyVector(BaseLine.endpoints[0]->node->node);1977 CircleCenter.AddVector(BaseLine.endpoints[1]->node->node);1978 CircleCenter.Scale(0.5);1979 1980 // construct normal vector of circle1981 CirclePlaneNormal.CopyVector(BaseLine.endpoints[0]->node->node); 1982 C irclePlaneNormal.SubtractVector(BaseLine.endpoints[1]->node->node);1983 1984 double radius = C irclePlaneNormal.NormSquared();1631 1632 helper.CopyVector(FirstPoint->node); 1633 helper.SubtractVector(SecondPoint->node); 1634 helper.Normalize(); 1635 Oben.ProjectOntoPlane(&helper); 1636 Oben.Normalize(); 1637 helper.VectorProduct(&Oben); 1638 ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1639 1640 Chord.CopyVector(FirstPoint->node); // bring into calling function 1641 Chord.SubtractVector(SecondPoint->node); 1642 double radius = Chord.ScalarProduct(&Chord); 1985 1643 double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.); 1986 1987 NormalVector.ProjectOntoPlane(&CirclePlaneNormal); 1988 NormalVector.Normalize(); 1989 ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1990 1991 SphereCenter.CopyVector(&NormalVector); 1992 SphereCenter.Scale(CircleRadius); 1993 SphereCenter.AddVector(&CircleCenter); 1994 // Now, NormalVector and SphereCenter are two orthonormalized vectors in the plane defined by CirclePlaneNormal (not normalized) 1644 helper.CopyVector(&Oben); 1645 helper.Scale(CircleRadius); 1646 // Now, oben and helper are two orthonormalized vectors in the plane defined by Chord (not normalized) 1995 1647 1996 1648 // look in one direction of baseline for initial candidate 1997 SearchDirection.MakeNormalVector(&C irclePlaneNormal, &NormalVector); // whether we look "left" first or "right" first is not important ...1649 SearchDirection.MakeNormalVector(&Chord, &Oben); // whether we look "left" first or "right" first is not important ... 1998 1650 1999 1651 // adding point 1 and point 2 and add the line between them 2000 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 2001 Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n"; 2002 2003 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n"; 2004 CandidateForTesselation OptCandidates(&BaseLine); 2005 FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC); 2006 Log() << Verbose(0) << "List of third Points is:" << endl; 2007 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 2008 Log() << Verbose(0) << " " << *(*it) << endl; 2009 } 2010 2011 BTS = NULL; 2012 AddCandidateTriangle(OptCandidates); 2013 // delete(BaseLine.endpoints[0]); 2014 // delete(BaseLine.endpoints[1]); 2015 1652 Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl; 1653 AddTesselationPoint(FirstPoint, 0); 1654 Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n"; 1655 AddTesselationPoint(SecondPoint, 1); 1656 AddTesselationLine(TPS[0], TPS[1], 0); 1657 1658 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1659 FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC); 1660 Log() << Verbose(1) << "List of third Points is "; 1661 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1662 Log() << Verbose(0) << " " << *(*it)->point; 1663 } 1664 Log() << Verbose(0) << endl; 1665 1666 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1667 // add third triangle point 1668 AddTesselationPoint((*it)->point, 2); 1669 // add the second and third line 1670 AddTesselationLine(TPS[1], TPS[2], 1); 1671 AddTesselationLine(TPS[0], TPS[2], 2); 1672 // ... and triangles to the Maps of the Tesselation class 1673 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1674 AddTesselationTriangle(); 1675 // ... and calculate its normal vector (with correct orientation) 1676 (*it)->OptCenter.Scale(-1.); 1677 Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl; 1678 BTS->GetNormalVector((*it)->OptCenter); // vector to compare with should point inwards 1679 Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " 1680 << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n"; 1681 1682 // if we do not reach the end with the next step of iteration, we need to setup a new first line 1683 if (it != OptCandidates->end()--) { 1684 FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1685 SecondPoint = (*it)->point; 1686 // adding point 1 and point 2 and the line between them 1687 AddTesselationPoint(FirstPoint, 0); 1688 AddTesselationPoint(SecondPoint, 1); 1689 AddTesselationLine(TPS[0], TPS[1], 0); 1690 } 1691 Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl; 1692 } 2016 1693 if (BTS != NULL) // we have created one starting triangle 2017 1694 break; 2018 1695 else { 2019 1696 // remove all candidates from the list and then the list itself 2020 OptCandidates.pointlist.clear(); 2021 } 2022 } 1697 class CandidateForTesselation *remover = NULL; 1698 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1699 remover = *it; 1700 delete(remover); 1701 } 1702 OptCandidates->clear(); 1703 } 1704 } 1705 1706 // remove all candidates from the list and then the list itself 1707 class CandidateForTesselation *remover = NULL; 1708 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1709 remover = *it; 1710 delete(remover); 1711 } 1712 delete(OptCandidates); 1713 Log() << Verbose(1) << "End of FindStartingTriangle\n"; 2023 1714 }; 2024 1715 2025 1716 /** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates. 2026 1717 * This is supposed to prevent early closing of the tesselation. 2027 * \param CandidateLine CandidateForTesselation with baseline and shortestangle, i.e. not \a *OptCandidate1718 * \param *BaseRay baseline, i.e. not \a *OptCandidate 2028 1719 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints 1720 * \param ShortestAngle path length on this circle band for the current \a *ThirdNode 2029 1721 * \param RADIUS radius of sphere 2030 1722 * \param *LC LinkedCell structure 2031 1723 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found 2032 1724 */ 2033 //bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const 2034 //{ 2035 // Info FunctionInfo(__func__); 2036 // bool result = false; 2037 // Vector CircleCenter; 2038 // Vector CirclePlaneNormal; 2039 // Vector OldSphereCenter; 2040 // Vector SearchDirection; 2041 // Vector helper; 2042 // TesselPoint *OtherOptCandidate = NULL; 2043 // double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 2044 // double radius, CircleRadius; 2045 // BoundaryLineSet *Line = NULL; 2046 // BoundaryTriangleSet *T = NULL; 2047 // 2048 // // check both other lines 2049 // PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 2050 // if (FindPoint != PointsOnBoundary.end()) { 2051 // for (int i=0;i<2;i++) { 2052 // LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 2053 // if (FindLine != (FindPoint->second)->lines.end()) { 2054 // Line = FindLine->second; 2055 // Log() << Verbose(0) << "Found line " << *Line << "." << endl; 2056 // if (Line->triangles.size() == 1) { 2057 // T = Line->triangles.begin()->second; 2058 // // construct center of circle 2059 // CircleCenter.CopyVector(Line->endpoints[0]->node->node); 2060 // CircleCenter.AddVector(Line->endpoints[1]->node->node); 2061 // CircleCenter.Scale(0.5); 2062 // 2063 // // construct normal vector of circle 2064 // CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 2065 // CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 2066 // 2067 // // calculate squared radius of circle 2068 // radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 2069 // if (radius/4. < RADIUS*RADIUS) { 2070 // CircleRadius = RADIUS*RADIUS - radius/4.; 2071 // CirclePlaneNormal.Normalize(); 2072 // //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2073 // 2074 // // construct old center 2075 // GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 2076 // helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 2077 // radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 2078 // helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2079 // OldSphereCenter.AddVector(&helper); 2080 // OldSphereCenter.SubtractVector(&CircleCenter); 2081 // //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 2082 // 2083 // // construct SearchDirection 2084 // SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 2085 // helper.CopyVector(Line->endpoints[0]->node->node); 2086 // helper.SubtractVector(ThirdNode->node); 2087 // if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 2088 // SearchDirection.Scale(-1.); 2089 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 2090 // SearchDirection.Normalize(); 2091 // Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2092 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 2093 // // rotated the wrong way! 2094 // eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 2095 // } 2096 // 2097 // // add third point 2098 // FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC); 2099 // for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) { 2100 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 2101 // continue; 2102 // Log() << Verbose(0) << " Third point candidate is " << (*it) 2103 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 2104 // Log() << Verbose(0) << " Baseline is " << *BaseRay << endl; 2105 // 2106 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 2107 // TesselPoint *PointCandidates[3]; 2108 // PointCandidates[0] = (*it); 2109 // PointCandidates[1] = BaseRay->endpoints[0]->node; 2110 // PointCandidates[2] = BaseRay->endpoints[1]->node; 2111 // bool check=false; 2112 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 2113 // // If there is no triangle, add it regularly. 2114 // if (existentTrianglesCount == 0) { 2115 // SetTesselationPoint((*it), 0); 2116 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 2117 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 2118 // 2119 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2120 // OtherOptCandidate = (*it); 2121 // check = true; 2122 // } 2123 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2124 // SetTesselationPoint((*it), 0); 2125 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 2126 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 2127 // 2128 // // 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) 2129 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2130 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 2131 // OtherOptCandidate = (*it); 2132 // check = true; 2133 // } 2134 // } 2135 // 2136 // if (check) { 2137 // if (ShortestAngle > OtherShortestAngle) { 2138 // Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 2139 // result = true; 2140 // break; 2141 // } 2142 // } 2143 // } 2144 // delete(OptCandidates); 2145 // if (result) 2146 // break; 2147 // } else { 2148 // Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 2149 // } 2150 // } else { 2151 // eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 2152 // } 2153 // } else { 2154 // Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 2155 // } 2156 // } 2157 // } else { 2158 // eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 2159 // } 2160 // 2161 // return result; 2162 //}; 1725 bool Tesselation::HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const ThirdNode, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const 1726 { 1727 bool result = false; 1728 Vector CircleCenter; 1729 Vector CirclePlaneNormal; 1730 Vector OldSphereCenter; 1731 Vector SearchDirection; 1732 Vector helper; 1733 TesselPoint *OtherOptCandidate = NULL; 1734 double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1735 double radius, CircleRadius; 1736 BoundaryLineSet *Line = NULL; 1737 BoundaryTriangleSet *T = NULL; 1738 1739 Log() << Verbose(1) << "Begin of HasOtherBaselineBetterCandidate" << endl; 1740 1741 // check both other lines 1742 PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 1743 if (FindPoint != PointsOnBoundary.end()) { 1744 for (int i=0;i<2;i++) { 1745 LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 1746 if (FindLine != (FindPoint->second)->lines.end()) { 1747 Line = FindLine->second; 1748 Log() << Verbose(1) << "Found line " << *Line << "." << endl; 1749 if (Line->triangles.size() == 1) { 1750 T = Line->triangles.begin()->second; 1751 // construct center of circle 1752 CircleCenter.CopyVector(Line->endpoints[0]->node->node); 1753 CircleCenter.AddVector(Line->endpoints[1]->node->node); 1754 CircleCenter.Scale(0.5); 1755 1756 // construct normal vector of circle 1757 CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 1758 CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 1759 1760 // calculate squared radius of circle 1761 radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 1762 if (radius/4. < RADIUS*RADIUS) { 1763 CircleRadius = RADIUS*RADIUS - radius/4.; 1764 CirclePlaneNormal.Normalize(); 1765 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1766 1767 // construct old center 1768 GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 1769 helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 1770 radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1771 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1772 OldSphereCenter.AddVector(&helper); 1773 OldSphereCenter.SubtractVector(&CircleCenter); 1774 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1775 1776 // construct SearchDirection 1777 SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 1778 helper.CopyVector(Line->endpoints[0]->node->node); 1779 helper.SubtractVector(ThirdNode->node); 1780 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1781 SearchDirection.Scale(-1.); 1782 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1783 SearchDirection.Normalize(); 1784 Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1785 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1786 // rotated the wrong way! 1787 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1788 } 1789 1790 // add third point 1791 CandidateList *OptCandidates = new CandidateList(); 1792 FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, Line, ThirdNode, OptCandidates, &OtherShortestAngle, RADIUS, LC); 1793 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1794 if (((*it)->point == BaseRay->endpoints[0]->node) || ((*it)->point == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1795 continue; 1796 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1797 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1798 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1799 1800 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1801 TesselPoint *PointCandidates[3]; 1802 PointCandidates[0] = (*it)->point; 1803 PointCandidates[1] = BaseRay->endpoints[0]->node; 1804 PointCandidates[2] = BaseRay->endpoints[1]->node; 1805 bool check=false; 1806 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1807 // If there is no triangle, add it regularly. 1808 if (existentTrianglesCount == 0) { 1809 SetTesselationPoint((*it)->point, 0); 1810 SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1811 SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1812 1813 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1814 OtherOptCandidate = (*it)->point; 1815 check = true; 1816 } 1817 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1818 SetTesselationPoint((*it)->point, 0); 1819 SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1820 SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1821 1822 // 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) 1823 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1824 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1825 OtherOptCandidate = (*it)->point; 1826 check = true; 1827 } 1828 } 1829 1830 if (check) { 1831 if (ShortestAngle > OtherShortestAngle) { 1832 Log() << Verbose(1) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 1833 result = true; 1834 break; 1835 } 1836 } 1837 } 1838 delete(OptCandidates); 1839 if (result) 1840 break; 1841 } else { 1842 Log() << Verbose(1) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 1843 } 1844 } else { 1845 eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 1846 } 1847 } else { 1848 Log() << Verbose(2) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 1849 } 1850 } 1851 } else { 1852 eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 1853 } 1854 1855 Log() << Verbose(1) << "End of HasOtherBaselineBetterCandidate" << endl; 1856 1857 return result; 1858 }; 2163 1859 2164 1860 /** This function finds a triangle to a line, adjacent to an existing one. 2165 1861 * @param out output stream for debugging 2166 * @param CandidateLine current cadndiatebaseline to search from1862 * @param Line current baseline to search from 2167 1863 * @param T current triangle which \a Line is edge of 2168 1864 * @param RADIUS radius of the rolling ball … … 2170 1866 * @param *LC LinkedCell structure with neighbouring points 2171 1867 */ 2172 bool Tesselation::FindNextSuitableTriangle( CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)2173 { 2174 Info FunctionInfo(__func__);1868 bool Tesselation::FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC) 1869 { 1870 Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n"; 2175 1871 bool result = true; 1872 CandidateList *OptCandidates = new CandidateList(); 2176 1873 2177 1874 Vector CircleCenter; 2178 1875 Vector CirclePlaneNormal; 2179 Vector RelativeSphereCenter;1876 Vector OldSphereCenter; 2180 1877 Vector SearchDirection; 2181 1878 Vector helper; 2182 1879 TesselPoint *ThirdNode = NULL; 2183 1880 LineMap::iterator testline; 1881 double ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 2184 1882 double radius, CircleRadius; 2185 1883 1884 Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl; 2186 1885 for (int i=0;i<3;i++) 2187 if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) {1886 if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node)) 2188 1887 ThirdNode = T.endpoints[i]->node; 2189 break;2190 }2191 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdNode " << *ThirdNode << " of triangle " << T << "." << endl;2192 1888 2193 1889 // construct center of circle 2194 CircleCenter.CopyVector( CandidateLine.BaseLine->endpoints[0]->node->node);2195 CircleCenter.AddVector( CandidateLine.BaseLine->endpoints[1]->node->node);1890 CircleCenter.CopyVector(Line.endpoints[0]->node->node); 1891 CircleCenter.AddVector(Line.endpoints[1]->node->node); 2196 1892 CircleCenter.Scale(0.5); 2197 1893 2198 1894 // construct normal vector of circle 2199 CirclePlaneNormal.CopyVector( CandidateLine.BaseLine->endpoints[0]->node->node);2200 CirclePlaneNormal.SubtractVector( CandidateLine.BaseLine->endpoints[1]->node->node);1895 CirclePlaneNormal.CopyVector(Line.endpoints[0]->node->node); 1896 CirclePlaneNormal.SubtractVector(Line.endpoints[1]->node->node); 2201 1897 2202 1898 // calculate squared radius of circle 2203 1899 radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 2204 1900 if (radius/4. < RADIUS*RADIUS) { 2205 // construct relative sphere center with now known CircleCenter2206 RelativeSphereCenter.CopyVector(&T.SphereCenter);2207 RelativeSphereCenter.SubtractVector(&CircleCenter);2208 2209 1901 CircleRadius = RADIUS*RADIUS - radius/4.; 2210 1902 CirclePlaneNormal.Normalize(); 2211 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2212 2213 Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl; 2214 2215 // construct SearchDirection and an "outward pointer" 2216 SearchDirection.MakeNormalVector(&RelativeSphereCenter, &CirclePlaneNormal); 2217 helper.CopyVector(&CircleCenter); 1903 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1904 1905 // construct old center 1906 GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node); 1907 helper.CopyVector(&T.NormalVector); // normal vector ensures that this is correct center of the two possible ones 1908 radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1909 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1910 OldSphereCenter.AddVector(&helper); 1911 OldSphereCenter.SubtractVector(&CircleCenter); 1912 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1913 1914 // construct SearchDirection 1915 SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal); 1916 helper.CopyVector(Line.endpoints[0]->node->node); 2218 1917 helper.SubtractVector(ThirdNode->node); 2219 1918 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 2220 1919 SearchDirection.Scale(-1.); 2221 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2222 if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1920 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1921 SearchDirection.Normalize(); 1922 Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1923 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 2223 1924 // rotated the wrong way! 2224 1925 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; … … 2226 1927 2227 1928 // add third point 2228 FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, ThirdNode, RADIUS, LC);1929 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC); 2229 1930 2230 1931 } else { 2231 Log() << Verbose( 0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;2232 } 2233 2234 if ( CandidateLine.pointlist.empty()) {1932 Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl; 1933 } 1934 1935 if (OptCandidates->begin() == OptCandidates->end()) { 2235 1936 eLog() << Verbose(2) << "Could not find a suitable candidate." << endl; 2236 1937 return false; 2237 1938 } 2238 Log() << Verbose(0) << "Third Points are: " << endl; 2239 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 2240 Log() << Verbose(0) << " " << *(*it) << endl; 2241 } 2242 2243 return true; 2244 2245 // BoundaryLineSet *BaseRay = CandidateLine.BaseLine; 2246 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2247 // Log() << Verbose(0) << "Third point candidate is " << *(*it)->point 2248 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 2249 // Log() << Verbose(0) << "Baseline is " << *BaseRay << endl; 2250 // 2251 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 2252 // TesselPoint *PointCandidates[3]; 2253 // PointCandidates[0] = (*it)->point; 2254 // PointCandidates[1] = BaseRay->endpoints[0]->node; 2255 // PointCandidates[2] = BaseRay->endpoints[1]->node; 2256 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 2257 // 2258 // BTS = NULL; 2259 // // check for present edges and whether we reach better candidates from them 2260 // //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 2261 // if (0) { 2262 // result = false; 2263 // break; 2264 // } else { 2265 // // If there is no triangle, add it regularly. 2266 // if (existentTrianglesCount == 0) { 2267 // AddTesselationPoint((*it)->point, 0); 2268 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2269 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2270 // 2271 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2272 // CandidateLine.point = (*it)->point; 2273 // CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter)); 2274 // CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter)); 2275 // CandidateLine.ShortestAngle = ShortestAngle; 2276 // } else { 2277 //// eLog() << Verbose(1) << "This triangle consisting of "; 2278 //// Log() << Verbose(0) << *(*it)->point << ", "; 2279 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2280 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2281 //// Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl; 2282 // result = false; 2283 // } 2284 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2285 // AddTesselationPoint((*it)->point, 0); 2286 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2287 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2288 // 2289 // // 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) 2290 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2291 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) { 2292 // CandidateLine.point = (*it)->point; 2293 // CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter); 2294 // CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter); 2295 // CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI; 2296 // 2297 // } else { 2298 //// 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; 2299 // result = false; 2300 // } 2301 // } else { 2302 //// Log() << Verbose(1) << "This triangle consisting of "; 2303 //// Log() << Verbose(0) << *(*it)->point << ", "; 2304 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2305 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2306 //// Log() << Verbose(0) << "is invalid!" << endl; 2307 // result = false; 2308 // } 2309 // } 2310 // 2311 // // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2312 // BaseRay = BLS[0]; 2313 // if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2314 // eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2315 // exit(255); 2316 // } 2317 // 2318 // } 2319 // 2320 // // remove all candidates from the list and then the list itself 2321 // class CandidateForTesselation *remover = NULL; 2322 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2323 // remover = *it; 2324 // delete(remover); 2325 // } 2326 // delete(OptCandidates); 1939 Log() << Verbose(1) << "Third Points are "; 1940 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1941 Log() << Verbose(1) << " " << *(*it)->point << endl; 1942 } 1943 1944 BoundaryLineSet *BaseRay = &Line; 1945 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1946 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1947 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1948 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1949 1950 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1951 TesselPoint *PointCandidates[3]; 1952 PointCandidates[0] = (*it)->point; 1953 PointCandidates[1] = BaseRay->endpoints[0]->node; 1954 PointCandidates[2] = BaseRay->endpoints[1]->node; 1955 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1956 1957 BTS = NULL; 1958 // check for present edges and whether we reach better candidates from them 1959 if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 1960 result = false; 1961 break; 1962 } else { 1963 // If there is no triangle, add it regularly. 1964 if (existentTrianglesCount == 0) { 1965 AddTesselationPoint((*it)->point, 0); 1966 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1967 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1968 1969 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1970 AddTesselationLine(TPS[0], TPS[1], 0); 1971 AddTesselationLine(TPS[0], TPS[2], 1); 1972 AddTesselationLine(TPS[1], TPS[2], 2); 1973 1974 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1975 AddTesselationTriangle(); 1976 (*it)->OptCenter.Scale(-1.); 1977 BTS->GetNormalVector((*it)->OptCenter); 1978 (*it)->OptCenter.Scale(-1.); 1979 1980 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1981 << " for this triangle ... " << endl; 1982 //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl; 1983 } else { 1984 eLog() << Verbose(2) << "This triangle consisting of "; 1985 Log() << Verbose(0) << *(*it)->point << ", "; 1986 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1987 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1988 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1989 result = false; 1990 } 1991 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1992 AddTesselationPoint((*it)->point, 0); 1993 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1994 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1995 1996 // 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) 1997 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1998 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1999 AddTesselationLine(TPS[0], TPS[1], 0); 2000 AddTesselationLine(TPS[0], TPS[2], 1); 2001 AddTesselationLine(TPS[1], TPS[2], 2); 2002 2003 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2004 AddTesselationTriangle(); // add to global map 2005 2006 (*it)->OtherOptCenter.Scale(-1.); 2007 BTS->GetNormalVector((*it)->OtherOptCenter); 2008 (*it)->OtherOptCenter.Scale(-1.); 2009 2010 eLog() << Verbose(2) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl; 2011 Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl; 2012 } else { 2013 eLog() << Verbose(2) << "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; 2014 result = false; 2015 } 2016 } else { 2017 Log() << Verbose(1) << "This triangle consisting of "; 2018 Log() << Verbose(0) << *(*it)->point << ", "; 2019 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2020 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2021 Log() << Verbose(0) << "is invalid!" << endl; 2022 result = false; 2023 } 2024 } 2025 2026 // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2027 BaseRay = BLS[0]; 2028 if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2029 eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2030 exit(255); 2031 } 2032 2033 } 2034 2035 // remove all candidates from the list and then the list itself 2036 class CandidateForTesselation *remover = NULL; 2037 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2038 remover = *it; 2039 delete(remover); 2040 } 2041 delete(OptCandidates); 2042 Log() << Verbose(0) << "End of FindNextSuitableTriangle\n"; 2327 2043 return result; 2328 };2329 2330 /** Adds the present line and candidate point from \a &CandidateLine to the Tesselation.2331 * \param CandidateLine triangle to add2332 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine()2333 */2334 void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine)2335 {2336 Info FunctionInfo(__func__);2337 Vector Center;2338 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node;2339 2340 // fill the set of neighbours2341 Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node);2342 Center.SubtractVector(TurningPoint->node);2343 set<TesselPoint*> SetOfNeighbours;2344 SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node);2345 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)2346 SetOfNeighbours.insert(*Runner);2347 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center);2348 2349 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)2350 TesselPointList::iterator Runner = connectedClosestPoints->begin();2351 TesselPointList::iterator Sprinter = Runner;2352 Sprinter++;2353 while(Sprinter != connectedClosestPoints->end()) {2354 // add the points2355 AddTesselationPoint(TurningPoint, 0);2356 AddTesselationPoint((*Runner), 1);2357 AddTesselationPoint((*Sprinter), 2);2358 2359 2360 // add the lines2361 AddTesselationLine(TPS[0], TPS[1], 0);2362 AddTesselationLine(TPS[0], TPS[2], 1);2363 AddTesselationLine(TPS[1], TPS[2], 2);2364 2365 // add the triangles2366 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);2367 AddTesselationTriangle();2368 BTS->GetCenter(&Center);2369 Center.SubtractVector(&CandidateLine.OptCenter);2370 BTS->SphereCenter.CopyVector(&CandidateLine.OptCenter);2371 BTS->GetNormalVector(Center);2372 2373 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl;2374 Runner = Sprinter;2375 Sprinter++;2376 }2377 delete(connectedClosestPoints);2378 2044 }; 2379 2045 … … 2387 2053 class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base) 2388 2054 { 2389 Info FunctionInfo(__func__);2390 2055 class BoundaryPointSet *Spot = NULL; 2391 2056 class BoundaryLineSet *OtherBase; … … 2399 2064 OtherBase = new class BoundaryLineSet(BPS,-1); 2400 2065 2401 Log() << Verbose( 1) << "INFO: Current base line is " << *Base << "." << endl;2402 Log() << Verbose( 1) << "INFO: Other base line is " << *OtherBase << "." << endl;2066 Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl; 2067 Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl; 2403 2068 2404 2069 // get the closest point on each line to the other line … … 2420 2085 delete(ClosestPoint); 2421 2086 if ((distance[0] * distance[1]) > 0) { // have same sign? 2422 Log() << Verbose( 1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;2087 Log() << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl; 2423 2088 if (distance[0] < distance[1]) { 2424 2089 Spot = Base->endpoints[0]; … … 2428 2093 return Spot; 2429 2094 } else { // different sign, i.e. we are in between 2430 Log() << Verbose( 0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;2095 Log() << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl; 2431 2096 return NULL; 2432 2097 } … … 2436 2101 void Tesselation::PrintAllBoundaryPoints(ofstream *out) const 2437 2102 { 2438 Info FunctionInfo(__func__);2439 2103 // print all lines 2440 Log() << Verbose( 0) << "Printing all boundary points for debugging:" << endl;2104 Log() << Verbose(1) << "Printing all boundary points for debugging:" << endl; 2441 2105 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++) 2442 Log() << Verbose( 0) << *(PointRunner->second) << endl;2106 Log() << Verbose(2) << *(PointRunner->second) << endl; 2443 2107 }; 2444 2108 2445 2109 void Tesselation::PrintAllBoundaryLines(ofstream *out) const 2446 2110 { 2447 Info FunctionInfo(__func__);2448 2111 // print all lines 2449 Log() << Verbose( 0) << "Printing all boundary lines for debugging:" << endl;2112 Log() << Verbose(1) << "Printing all boundary lines for debugging:" << endl; 2450 2113 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 2451 Log() << Verbose( 0) << *(LineRunner->second) << endl;2114 Log() << Verbose(2) << *(LineRunner->second) << endl; 2452 2115 }; 2453 2116 2454 2117 void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const 2455 2118 { 2456 Info FunctionInfo(__func__);2457 2119 // print all triangles 2458 Log() << Verbose( 0) << "Printing all boundary triangles for debugging:" << endl;2120 Log() << Verbose(1) << "Printing all boundary triangles for debugging:" << endl; 2459 2121 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 2460 Log() << Verbose( 0) << *(TriangleRunner->second) << endl;2122 Log() << Verbose(2) << *(TriangleRunner->second) << endl; 2461 2123 }; 2462 2124 … … 2468 2130 double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base) 2469 2131 { 2470 Info FunctionInfo(__func__);2471 2132 class BoundaryLineSet *OtherBase; 2472 2133 Vector *ClosestPoint[2]; … … 2480 2141 OtherBase = new class BoundaryLineSet(BPS,-1); 2481 2142 2482 Log() << Verbose( 0) << "INFO: Current base line is " << *Base << "." << endl;2483 Log() << Verbose( 0) << "INFO: Other base line is " << *OtherBase << "." << endl;2143 Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl; 2144 Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl; 2484 2145 2485 2146 // get the closest point on each line to the other line … … 2501 2162 2502 2163 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 2503 Log() << Verbose( 0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;2164 Log() << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl; 2504 2165 return false; 2505 2166 } else { // check for sign against BaseLineNormal … … 2511 2172 } 2512 2173 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2513 Log() << Verbose( 1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2174 Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2514 2175 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2515 2176 } … … 2517 2178 2518 2179 if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 2519 Log() << Verbose( 0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;2180 Log() << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl; 2520 2181 // calculate volume summand as a general tetraeder 2521 2182 return volume; 2522 2183 } else { // Base higher than OtherBase -> do nothing 2523 Log() << Verbose( 0) << "REJECT: Base line is higher: Nothing to do." << endl;2184 Log() << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl; 2524 2185 return 0.; 2525 2186 } … … 2536 2197 class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base) 2537 2198 { 2538 Info FunctionInfo(__func__);2539 2199 class BoundaryLineSet *OldLines[4], *NewLine; 2540 2200 class BoundaryPointSet *OldPoints[2]; … … 2543 2203 int i,m; 2544 2204 2205 Log() << Verbose(1) << "Begin of FlipBaseline" << endl; 2206 2545 2207 // calculate NormalVector for later use 2546 2208 BaseLineNormal.Zero(); … … 2550 2212 } 2551 2213 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2552 Log() << Verbose( 1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2214 Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2553 2215 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2554 2216 } … … 2563 2225 i=0; 2564 2226 m=0; 2565 Log() << Verbose( 0) << "The four old lines are: ";2227 Log() << Verbose(3) << "The four old lines are: "; 2566 2228 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2567 2229 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2571 2233 } 2572 2234 Log() << Verbose(0) << endl; 2573 Log() << Verbose( 0) << "The two old points are: ";2235 Log() << Verbose(3) << "The two old points are: "; 2574 2236 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2575 2237 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2597 2259 2598 2260 // remove triangles and baseline removes itself 2599 Log() << Verbose( 0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;2261 Log() << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl; 2600 2262 OldBaseLineNr = Base->Nr; 2601 2263 m=0; 2602 2264 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2603 Log() << Verbose( 0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;2265 Log() << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl; 2604 2266 OldTriangleNrs[m++] = runner->second->Nr; 2605 2267 RemoveTesselationTriangle(runner->second); … … 2611 2273 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 2612 2274 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 2613 Log() << Verbose( 0) << "INFO: Created new baseline " << *NewLine << "." << endl;2275 Log() << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl; 2614 2276 2615 2277 // construct new triangles with flipped baseline … … 2626 2288 BTS->GetNormalVector(BaseLineNormal); 2627 2289 AddTesselationTriangle(OldTriangleNrs[0]); 2628 Log() << Verbose( 0) << "INFO: Created new triangle " << *BTS << "." << endl;2290 Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl; 2629 2291 2630 2292 BLS[0] = (i==2 ? OldLines[3] : OldLines[2]); … … 2634 2296 BTS->GetNormalVector(BaseLineNormal); 2635 2297 AddTesselationTriangle(OldTriangleNrs[1]); 2636 Log() << Verbose( 0) << "INFO: Created new triangle " << *BTS << "." << endl;2298 Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl; 2637 2299 } else { 2638 eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl;2300 Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl; 2639 2301 return NULL; 2640 2302 } 2641 2303 2304 Log() << Verbose(1) << "End of FlipBaseline" << endl; 2642 2305 return NewLine; 2643 2306 }; … … 2654 2317 void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC) 2655 2318 { 2656 Info FunctionInfo(__func__);2319 Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl; 2657 2320 Vector AngleCheck; 2658 2321 class TesselPoint* Candidate = NULL; … … 2675 2338 Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1; 2676 2339 } 2677 Log() << Verbose( 0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"2340 Log() << Verbose(3) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" 2678 2341 << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl; 2679 2342 … … 2682 2345 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2683 2346 const LinkedNodes *List = LC->GetCurrentCell(); 2684 //Log() << Verbose( 1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2347 //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2685 2348 if (List != NULL) { 2686 2349 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2713 2376 angle = AngleCheck.Angle(&Oben); 2714 2377 if (angle < Storage[0]) { 2715 //Log() << Verbose( 1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);2716 Log() << Verbose( 1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";2378 //Log() << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 2379 Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"; 2717 2380 OptCandidate = Candidate; 2718 2381 Storage[0] = angle; 2719 //Log() << Verbose( 1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);2382 //Log() << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]); 2720 2383 } else { 2721 //Log() << Verbose( 1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;2384 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl; 2722 2385 } 2723 2386 } else { 2724 //Log() << Verbose( 1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;2387 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl; 2725 2388 } 2726 2389 } else { 2727 //Log() << Verbose( 1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;2390 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl; 2728 2391 } 2729 2392 } 2730 2393 } else { 2731 Log() << Verbose( 0) << "Linked cell list is empty." << endl;2394 Log() << Verbose(3) << "Linked cell list is empty." << endl; 2732 2395 } 2733 2396 } 2397 Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl; 2734 2398 }; 2735 2399 … … 2760 2424 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine 2761 2425 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle 2762 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle2426 * @param BaseLine BoundaryLineSet with the current base line 2763 2427 * @param ThirdNode third point to avoid in search 2428 * @param candidates list of equally good candidates to return 2429 * @param ShortestAngle the current path length on this circle band for the current OptCandidate 2764 2430 * @param RADIUS radius of sphere 2765 2431 * @param *LC LinkedCell structure with neighbouring points 2766 2432 */ 2767 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const 2768 { 2769 Info FunctionInfo(__func__); 2433 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const 2434 { 2770 2435 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 2771 2436 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in … … 2775 2440 Vector NewNormalVector; // normal vector of the Candidate's triangle 2776 2441 Vector helper, OptCandidateCenter, OtherOptCandidateCenter; 2777 Vector RelativeOldSphereCenter;2778 Vector NewPlaneCenter;2779 2442 double CircleRadius; // radius of this circle 2780 2443 double radius; 2781 double otherradius;2782 2444 double alpha, Otheralpha; // angles (i.e. parameter for the circle). 2783 bool IsDegenerated;2784 2445 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 2785 2446 TesselPoint *Candidate = NULL; 2786 TesselPoint *CandidateTriangle[3]; 2787 2788 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2447 CandidateForTesselation *optCandidate = NULL; 2448 2449 Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl; 2450 2451 Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2789 2452 2790 2453 // construct center of circle 2791 CircleCenter.CopyVector( CandidateLine.BaseLine->endpoints[0]->node->node);2792 CircleCenter.AddVector( CandidateLine.BaseLine->endpoints[1]->node->node);2454 CircleCenter.CopyVector(BaseLine->endpoints[0]->node->node); 2455 CircleCenter.AddVector(BaseLine->endpoints[1]->node->node); 2793 2456 CircleCenter.Scale(0.5); 2794 2457 2795 2458 // construct normal vector of circle 2796 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2797 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2798 2799 RelativeOldSphereCenter.CopyVector(&OldSphereCenter); 2800 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 2801 2802 CandidateTriangle[0] = CandidateLine.BaseLine->endpoints[0]->node; 2803 CandidateTriangle[1] = CandidateLine.BaseLine->endpoints[1]->node; 2459 CirclePlaneNormal.CopyVector(BaseLine->endpoints[0]->node->node); 2460 CirclePlaneNormal.SubtractVector(BaseLine->endpoints[1]->node->node); 2804 2461 2805 2462 // calculate squared radius TesselPoint *ThirdNode,f circle 2806 radius = CirclePlaneNormal. NormSquared()/4.;2807 if (radius < RADIUS*RADIUS) {2808 CircleRadius = RADIUS*RADIUS - radius ;2463 radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 2464 if (radius/4. < RADIUS*RADIUS) { 2465 CircleRadius = RADIUS*RADIUS - radius/4.; 2809 2466 CirclePlaneNormal.Normalize(); 2810 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;2467 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2811 2468 2812 2469 // test whether old center is on the band's plane 2813 if (fabs( RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {2814 eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;2815 RelativeOldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);2816 } 2817 radius = RelativeOldSphereCenter.NormSquared();2470 if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { 2471 eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl; 2472 OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal); 2473 } 2474 radius = OldSphereCenter.ScalarProduct(&OldSphereCenter); 2818 2475 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2819 Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl;2476 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 2820 2477 2821 2478 // check SearchDirection 2822 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;2823 if (fabs( RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way!2479 //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2480 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2824 2481 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl; 2825 2482 } … … 2829 2486 for(int i=0;i<NDIM;i++) // store indices of this cell 2830 2487 N[i] = LC->n[i]; 2831 //Log() << Verbose( 1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2488 //Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 2832 2489 } else { 2833 2490 eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl; … … 2835 2492 } 2836 2493 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2837 //Log() << Verbose( 1) << "LC Intervals:";2494 //Log() << Verbose(2) << "LC Intervals:"; 2838 2495 for (int i=0;i<NDIM;i++) { 2839 2496 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; … … 2846 2503 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2847 2504 const LinkedNodes *List = LC->GetCurrentCell(); 2848 //Log() << Verbose( 1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2505 //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2849 2506 if (List != NULL) { 2850 2507 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2852 2509 2853 2510 // check for three unique points 2854 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter<< "." << endl;2855 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){2856 2857 // find center on the plane2858 GetCenterofCircumcircle(&New PlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);2859 Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;2860 2861 if ((NewNormalVector.MakeNormalVector( CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node))2862 && (fabs(NewNormalVector. NormSquared()) > HULLEPSILON)2511 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl; 2512 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){ 2513 2514 // construct both new centers 2515 GetCenterofCircumcircle(&NewSphereCenter, *BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node); 2516 OtherNewSphereCenter.CopyVector(&NewSphereCenter); 2517 2518 if ((NewNormalVector.MakeNormalVector(BaseLine->endpoints[0]->node->node, BaseLine->endpoints[1]->node->node, Candidate->node)) 2519 && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON) 2863 2520 ) { 2864 Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2865 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter); 2866 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2867 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2868 Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl; 2521 helper.CopyVector(&NewNormalVector); 2522 //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2523 radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter); 2869 2524 if (radius < RADIUS*RADIUS) { 2870 otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);2871 if (fabs(radius - otherradius) > HULLEPSILON) {2872 eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl;2873 }2874 // construct both new centers2875 NewSphereCenter.CopyVector(&NewPlaneCenter);2876 OtherNewSphereCenter.CopyVector(&NewPlaneCenter);2877 helper.CopyVector(&NewNormalVector);2878 2525 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2879 Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper<< " with sphere radius " << RADIUS << "." << endl;2526 //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl; 2880 2527 NewSphereCenter.AddVector(&helper); 2881 Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2528 NewSphereCenter.SubtractVector(&CircleCenter); 2529 //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2530 2882 2531 // OtherNewSphereCenter is created by the same vector just in the other direction 2883 2532 helper.Scale(-1.); 2884 2533 OtherNewSphereCenter.AddVector(&helper); 2885 Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2534 OtherNewSphereCenter.SubtractVector(&CircleCenter); 2535 //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2886 2536 2887 2537 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 2888 2538 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 2889 2539 alpha = min(alpha, Otheralpha); 2890 2891 CandidateTriangle[2] = Candidate; 2892 // the idea of the IsDegenerated flag is not to put a penalty on degenerated triangles, but to push them to the 2893 // very end of the Tesselation::OpenLines list. 2894 IsDegenerated = (CheckPresenceOfTriangle(CandidateTriangle) >= 3); 2895 if (!IsDegenerated && CandidateLine.IsDegenerated) { // if current is not, but old one was, comparison would be unfair 2896 // if there is a better candidate, drop the current list and add the new candidate 2897 // otherwise ignore the new candidate and keep the list 2898 if (CandidateLine.ShortestAngle-2.*M_PI > (alpha - HULLEPSILON)) { 2899 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2900 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2901 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2902 } else { 2903 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2904 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2540 // if there is a better candidate, drop the current list and add the new candidate 2541 // otherwise ignore the new candidate and keep the list 2542 if (*ShortestAngle > (alpha - HULLEPSILON)) { 2543 optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter); 2544 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2545 optCandidate->OptCenter.CopyVector(&NewSphereCenter); 2546 optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2547 } else { 2548 optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter); 2549 optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter); 2550 } 2551 // if there is an equal candidate, add it to the list without clearing the list 2552 if ((*ShortestAngle - HULLEPSILON) < alpha) { 2553 candidates->push_back(optCandidate); 2554 Log() << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with " 2555 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl; 2556 } else { 2557 // remove all candidates from the list and then the list itself 2558 class CandidateForTesselation *remover = NULL; 2559 for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) { 2560 remover = *it; 2561 delete(remover); 2905 2562 } 2906 // if there is an equal candidate, add it to the list without clearing the list 2907 if ((CandidateLine.ShortestAngle-2.*M_PI - HULLEPSILON) < alpha) { 2908 CandidateLine.pointlist.push_back(Candidate); 2909 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2910 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2911 } else { 2912 // remove all candidates from the list and then the list itself 2913 CandidateLine.pointlist.clear(); 2914 CandidateLine.pointlist.push_back(Candidate); 2915 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2916 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2917 } 2918 CandidateLine.ShortestAngle = alpha; 2919 CandidateLine.IsDegenerated = IsDegenerated; 2920 if (IsDegenerated) 2921 CandidateLine.ShortestAngle += 2.*M_PI; 2922 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2563 candidates->clear(); 2564 candidates->push_back(optCandidate); 2565 Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with " 2566 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl; 2567 } 2568 *ShortestAngle = alpha; 2569 //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl; 2570 } else { 2571 if ((optCandidate != NULL) && (optCandidate->point != NULL)) { 2572 //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2923 2573 } else { 2924 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2925 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2926 } else { 2927 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2928 } 2929 } 2930 } else { 2931 // if there is a better candidate, drop the current list and add the new candidate 2932 // otherwise ignore the new candidate and keep the list 2933 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2934 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2935 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2936 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2937 } else { 2938 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2939 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2940 } 2941 // if there is an equal candidate, add it to the list without clearing the list 2942 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2943 CandidateLine.pointlist.push_back(Candidate); 2944 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2945 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2946 } else { 2947 // remove all candidates from the list and then the list itself 2948 CandidateLine.pointlist.clear(); 2949 CandidateLine.pointlist.push_back(Candidate); 2950 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2951 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2952 } 2953 CandidateLine.ShortestAngle = alpha; 2954 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2955 } else { 2956 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2957 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2958 } else { 2959 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2960 } 2574 //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2961 2575 } 2962 2576 } 2963 2577 2964 2578 } else { 2965 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;2579 //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl; 2966 2580 } 2967 2581 } else { 2968 Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2582 //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl; 2969 2583 } 2970 2584 } else { 2971 2585 if (ThirdNode != NULL) { 2972 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;2586 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl; 2973 2587 } else { 2974 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;2588 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl; 2975 2589 } 2976 2590 } … … 2983 2597 } else { 2984 2598 if (ThirdNode != NULL) 2985 Log() << Verbose( 1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;2599 Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl; 2986 2600 else 2987 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl; 2988 } 2989 2990 Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl; 2991 if (CandidateLine.pointlist.size() > 1) { 2992 CandidateLine.pointlist.unique(); 2993 CandidateLine.pointlist.sort(); //SortCandidates); 2994 } 2601 Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl; 2602 } 2603 2604 //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl; 2605 if (candidates->size() > 1) { 2606 candidates->unique(); 2607 candidates->sort(SortCandidates); 2608 } 2609 2610 Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl; 2995 2611 }; 2996 2612 … … 3002 2618 class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const 3003 2619 { 3004 Info FunctionInfo(__func__);3005 2620 const BoundaryLineSet * lines[2] = { line1, line2 }; 3006 2621 class BoundaryPointSet *node = NULL; … … 3016 2631 { // if insertion fails, we have common endpoint 3017 2632 node = OrderTest.first->second; 3018 Log() << Verbose( 1) << "Common endpoint of lines " << *line12633 Log() << Verbose(5) << "Common endpoint of lines " << *line1 3019 2634 << " and " << *line2 << " is: " << *node << "." << endl; 3020 2635 j = 2; … … 3033 2648 list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const 3034 2649 { 3035 Info FunctionInfo(__func__);3036 2650 TesselPoint *trianglePoints[3]; 3037 2651 TesselPoint *SecondPoint = NULL; … … 3039 2653 3040 2654 if (LinesOnBoundary.empty()) { 3041 eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first.";2655 Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first."; 3042 2656 return NULL; 3043 2657 } … … 3047 2661 // check whether closest point is "too close" :), then it's inside 3048 2662 if (trianglePoints[0] == NULL) { 3049 Log() << Verbose( 0) << "Is the only point, no one else is closeby." << endl;2663 Log() << Verbose(2) << "Is the only point, no one else is closeby." << endl; 3050 2664 return NULL; 3051 2665 } 3052 2666 if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) { 3053 Log() << Verbose( 1) << "Point is right on a tesselation point, no nearest triangle." << endl;2667 Log() << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl; 3054 2668 PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr); 3055 2669 triangles = new list<BoundaryTriangleSet*>; … … 3075 2689 } 3076 2690 } else { 3077 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]); 3078 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x); 3079 delete(connectedPoints); 2691 list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x); 3080 2692 if (connectedClosestPoints != NULL) { 3081 2693 trianglePoints[1] = connectedClosestPoints->front(); … … 3085 2697 eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl; 3086 2698 } 3087 //Log() << Verbose( 1) << "List of triangle points:" << endl;3088 //Log() << Verbose( 2) << *trianglePoints[i] << endl;2699 //Log() << Verbose(2) << "List of triangle points:" << endl; 2700 //Log() << Verbose(3) << *trianglePoints[i] << endl; 3089 2701 } 3090 2702 3091 2703 triangles = FindTriangles(trianglePoints); 3092 Log() << Verbose( 1) << "List of possible triangles:" << endl;2704 Log() << Verbose(2) << "List of possible triangles:" << endl; 3093 2705 for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) 3094 Log() << Verbose( 2) << **Runner << endl;2706 Log() << Verbose(3) << **Runner << endl; 3095 2707 3096 2708 delete(connectedClosestPoints); 3097 2709 } else { 3098 2710 triangles = NULL; 3099 eLog() << Verbose(2) << "There is no circle of connected points!" << endl;2711 Log() << Verbose(1) << "There is no circle of connected points!" << endl; 3100 2712 } 3101 2713 } … … 3117 2729 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const 3118 2730 { 3119 Info FunctionInfo(__func__);3120 2731 class BoundaryTriangleSet *result = NULL; 3121 2732 list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC); … … 3127 2738 if (triangles->size() == 1) { // there is no degenerate case 3128 2739 result = triangles->front(); 3129 Log() << Verbose( 1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;2740 Log() << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl; 3130 2741 } else { 3131 2742 result = triangles->front(); 3132 2743 result->GetCenter(&Center); 3133 2744 Center.SubtractVector(x); 3134 Log() << Verbose( 1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;2745 Log() << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl; 3135 2746 if (Center.ScalarProduct(&result->NormalVector) < 0) { 3136 2747 result = triangles->back(); 3137 Log() << Verbose( 1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;2748 Log() << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl; 3138 2749 if (Center.ScalarProduct(&result->NormalVector) < 0) { 3139 2750 eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl; … … 3154 2765 bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const 3155 2766 { 3156 Info FunctionInfo(__func__);3157 2767 class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC); 3158 2768 Vector Center; … … 3164 2774 3165 2775 result->GetCenter(&Center); 3166 Log() << Verbose( 2) << "INFO: Central point of the triangle is " << Center << "." << endl;2776 Log() << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl; 3167 2777 Center.SubtractVector(&Point); 3168 Log() << Verbose( 2) << "INFO: Vector from center to point to test is " << Center << "." << endl;2778 Log() << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl; 3169 2779 if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) { 3170 2780 Log() << Verbose(1) << Point << " is an inner point." << endl; … … 3185 2795 bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const 3186 2796 { 3187 Info FunctionInfo(__func__);3188 2797 return IsInnerPoint(*(Point->node), LC); 3189 2798 } … … 3197 2806 set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const 3198 2807 { 3199 Info FunctionInfo(__func__);3200 2808 set<TesselPoint*> *connectedPoints = new set<TesselPoint*>; 3201 2809 class BoundaryPointSet *ReferencePoint = NULL; 3202 2810 TesselPoint* current; 3203 2811 bool takePoint = false; 2812 2813 Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl; 3204 2814 3205 2815 // find the respective boundary point … … 3208 2818 ReferencePoint = PointRunner->second; 3209 2819 } else { 3210 eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;2820 Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 3211 2821 ReferencePoint = NULL; 3212 2822 } … … 3232 2842 3233 2843 if (takePoint) { 3234 Log() << Verbose( 1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;2844 Log() << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl; 3235 2845 connectedPoints->insert(current); 3236 2846 } … … 3244 2854 } 3245 2855 2856 Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl; 3246 2857 return connectedPoints; 3247 2858 }; … … 3255 2866 * 3256 2867 * @param *out output stream for debugging 3257 * @param *SetOfNeighbours all points for which the angle should be calculated3258 2868 * @param *Point of which get all connected points 3259 2869 * @param *Reference Reference vector for zero angle or NULL for no preference 3260 2870 * @return list of the all points linked to the provided one 3261 2871 */ 3262 list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const 3263 { 3264 Info FunctionInfo(__func__); 2872 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const 2873 { 3265 2874 map<double, TesselPoint*> anglesOfPoints; 2875 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point); 3266 2876 list<TesselPoint*> *connectedCircle = new list<TesselPoint*>; 3267 2877 Vector center; … … 3271 2881 Vector helper; 3272 2882 3273 if ( SetOfNeighbours == NULL) {3274 eLog() << Verbose(2) << "Could not find any connected points!" << endl;2883 if (connectedPoints == NULL) { 2884 Log() << Verbose(2) << "Could not find any connected points!" << endl; 3275 2885 delete(connectedCircle); 3276 2886 return NULL; 3277 2887 } 2888 Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl; 3278 2889 3279 2890 // calculate central point 3280 for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++)2891 for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++) 3281 2892 center.AddVector((*TesselRunner)->node); 3282 2893 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 3283 2894 // << "; scale factor " << 1.0/connectedPoints.size(); 3284 center.Scale(1.0/ SetOfNeighbours->size());3285 Log() << Verbose( 1) << "INFO: Calculated center of all circle points is " << center << "." << endl;2895 center.Scale(1.0/connectedPoints->size()); 2896 Log() << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl; 3286 2897 3287 2898 // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 3289 2900 PlaneNormal.SubtractVector(¢er); 3290 2901 PlaneNormal.Normalize(); 3291 Log() << Verbose( 1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;2902 Log() << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl; 3292 2903 3293 2904 // construct one orthogonal vector … … 3298 2909 } 3299 2910 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) { 3300 Log() << Verbose( 1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;3301 AngleZero.CopyVector((* SetOfNeighbours->begin())->node);2911 Log() << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl; 2912 AngleZero.CopyVector((*connectedPoints->begin())->node); 3302 2913 AngleZero.SubtractVector(Point->node); 3303 2914 AngleZero.ProjectOntoPlane(&PlaneNormal); … … 3307 2918 } 3308 2919 } 3309 Log() << Verbose( 1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;2920 Log() << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl; 3310 2921 if (AngleZero.NormSquared() > MYEPSILON) 3311 2922 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 3312 2923 else 3313 2924 OrthogonalVector.MakeNormalVector(&PlaneNormal); 3314 Log() << Verbose( 1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;2925 Log() << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl; 3315 2926 3316 2927 // go through all connected points and calculate angle 3317 for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {2928 for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) { 3318 2929 helper.CopyVector((*listRunner)->node); 3319 2930 helper.SubtractVector(Point->node); 3320 2931 helper.ProjectOntoPlane(&PlaneNormal); 3321 2932 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 3322 Log() << Verbose( 0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;2933 Log() << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl; 3323 2934 anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner))); 3324 2935 } … … 3327 2938 connectedCircle->push_back(AngleRunner->second); 3328 2939 } 2940 2941 delete(connectedPoints); 2942 2943 Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl; 3329 2944 3330 2945 return connectedCircle; … … 3339 2954 list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const 3340 2955 { 3341 Info FunctionInfo(__func__);3342 2956 map<double, TesselPoint*> anglesOfPoints; 3343 2957 list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>; … … 3384 2998 StartLine = CurrentLine; 3385 2999 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 3386 Log() << Verbose( 1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;3000 Log() << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl; 3387 3001 do { 3388 3002 // push current one 3389 Log() << Verbose( 1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3003 Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 3390 3004 connectedPath->push_back(CurrentPoint->node); 3391 3005 3392 3006 // find next triangle 3393 3007 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 3394 Log() << Verbose( 1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;3008 Log() << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl; 3395 3009 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 3396 3010 triangle = Runner->second; … … 3399 3013 if (!TriangleRunner->second) { 3400 3014 TriangleRunner->second = true; 3401 Log() << Verbose( 1) << "INFO: Connecting triangle is " << *triangle << "." << endl;3015 Log() << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl; 3402 3016 break; 3403 3017 } else { 3404 Log() << Verbose( 1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;3018 Log() << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl; 3405 3019 triangle = NULL; 3406 3020 } … … 3417 3031 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 3418 3032 CurrentLine = triangle->lines[i]; 3419 Log() << Verbose( 1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;3033 Log() << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl; 3420 3034 break; 3421 3035 } … … 3431 3045 } while (CurrentLine != StartLine); 3432 3046 // last point is missing, as it's on start line 3433 Log() << Verbose( 1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3047 Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 3434 3048 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 3435 3049 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 3437 3051 ListOfPaths->push_back(connectedPath); 3438 3052 } else { 3439 Log() << Verbose( 1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;3053 Log() << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl; 3440 3054 } 3441 3055 } … … 3455 3069 list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const 3456 3070 { 3457 Info FunctionInfo(__func__);3458 3071 list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point); 3459 3072 list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>; … … 3469 3082 connectedPath = *ListRunner; 3470 3083 3471 Log() << Verbose( 1) << "INFO: Current path is " << connectedPath << "." << endl;3084 Log() << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl; 3472 3085 3473 3086 // go through list, look for reappearance of starting Point and count … … 3479 3092 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 3480 3093 // we have a closed circle from Marker to new Marker 3481 Log() << Verbose( 1) << count+1 << ". closed path consists of: ";3094 Log() << Verbose(3) << count+1 << ". closed path consists of: "; 3482 3095 newPath = new list<TesselPoint*>; 3483 3096 list<TesselPoint*>::iterator CircleSprinter = Marker; … … 3495 3108 } 3496 3109 } 3497 Log() << Verbose( 1) << "INFO: " << count << " closed additional path(s) have been created." << endl;3110 Log() << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl; 3498 3111 3499 3112 // delete list of paths … … 3517 3130 set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const 3518 3131 { 3519 Info FunctionInfo(__func__);3520 3132 set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>; 3521 3133 … … 3556 3168 return 0.; 3557 3169 } else 3558 Log() << Verbose( 0) << "Removing point " << *point << " from tesselated boundary ..." << endl;3170 Log() << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl; 3559 3171 3560 3172 // copy old location for the volume … … 3586 3198 NormalVector.Zero(); 3587 3199 for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3588 Log() << Verbose( 1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;3200 Log() << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl; 3589 3201 NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward 3590 3202 RemoveTesselationTriangle(Runner->first); … … 3616 3228 smallestangle = 0.; 3617 3229 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3618 Log() << Verbose( 1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3230 Log() << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3619 3231 // construct vectors to next and previous neighbour 3620 3232 StartNode = MiddleNode; … … 3644 3256 MiddleNode = EndNode; 3645 3257 if (MiddleNode == connectedPath->end()) { 3646 eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl;3647 performCriticalExit();3258 Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl; 3259 exit(255); 3648 3260 } 3649 3261 StartNode = MiddleNode; … … 3654 3266 if (EndNode == connectedPath->end()) 3655 3267 EndNode = connectedPath->begin(); 3656 Log() << Verbose( 2) << "INFO: StartNode is " << **StartNode << "." << endl;3657 Log() << Verbose( 2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3658 Log() << Verbose( 2) << "INFO: EndNode is " << **EndNode << "." << endl;3659 Log() << Verbose( 1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;3268 Log() << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl; 3269 Log() << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3270 Log() << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl; 3271 Log() << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl; 3660 3272 TriangleCandidates[0] = *StartNode; 3661 3273 TriangleCandidates[1] = *MiddleNode; … … 3663 3275 triangle = GetPresentTriangle(TriangleCandidates); 3664 3276 if (triangle != NULL) { 3665 eLog() << Verbose( 0) << "New triangle already present, skipping!" << endl;3277 eLog() << Verbose(2) << "New triangle already present, skipping!" << endl; 3666 3278 StartNode++; 3667 3279 MiddleNode++; … … 3675 3287 continue; 3676 3288 } 3677 Log() << Verbose( 3) << "Adding new triangle points."<< endl;3289 Log() << Verbose(5) << "Adding new triangle points."<< endl; 3678 3290 AddTesselationPoint(*StartNode, 0); 3679 3291 AddTesselationPoint(*MiddleNode, 1); 3680 3292 AddTesselationPoint(*EndNode, 2); 3681 Log() << Verbose( 3) << "Adding new triangle lines."<< endl;3293 Log() << Verbose(5) << "Adding new triangle lines."<< endl; 3682 3294 AddTesselationLine(TPS[0], TPS[1], 0); 3683 3295 AddTesselationLine(TPS[0], TPS[2], 1); … … 3694 3306 // prepare nodes for next triangle 3695 3307 StartNode = EndNode; 3696 Log() << Verbose( 2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;3308 Log() << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl; 3697 3309 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3698 3310 if (connectedPath->size() == 2) { // we are done … … 3701 3313 break; 3702 3314 } else if (connectedPath->size() < 2) { // something's gone wrong! 3703 eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl;3704 performCriticalExit();3315 Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl; 3316 exit(255); 3705 3317 } else { 3706 3318 MiddleNode = StartNode; … … 3730 3342 if (maxgain != 0) { 3731 3343 volume += maxgain; 3732 Log() << Verbose( 1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;3344 Log() << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl; 3733 3345 OtherBase = FlipBaseline(*Candidate); 3734 3346 NewLines.erase(Candidate); … … 3741 3353 delete(connectedPath); 3742 3354 } 3743 Log() << Verbose( 0) << count << " triangles were created." << endl;3355 Log() << Verbose(1) << count << " triangles were created." << endl; 3744 3356 } else { 3745 3357 while (!ListOfClosedPaths->empty()) { … … 3749 3361 delete(connectedPath); 3750 3362 } 3751 Log() << Verbose( 0) << "No need to create any triangles." << endl;3363 Log() << Verbose(1) << "No need to create any triangles." << endl; 3752 3364 } 3753 3365 delete(ListOfClosedPaths); 3754 3366 3755 Log() << Verbose( 0) << "Removed volume is " << volume << "." << endl;3367 Log() << Verbose(1) << "Removed volume is " << volume << "." << endl; 3756 3368 3757 3369 return volume; … … 3770 3382 list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const 3771 3383 { 3772 Info FunctionInfo(__func__);3773 3384 list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>; 3774 3385 LineMap::const_iterator FindLine; … … 3811 3422 } 3812 3423 3813 struct BoundaryLineSetCompare {3814 bool operator() (const BoundaryLineSet * const a, const BoundaryLineSet * const b) {3815 int lowerNra = -1;3816 int lowerNrb = -1;3817 3818 if (a->endpoints[0] < a->endpoints[1])3819 lowerNra = 0;3820 else3821 lowerNra = 1;3822 3823 if (b->endpoints[0] < b->endpoints[1])3824 lowerNrb = 0;3825 else3826 lowerNrb = 1;3827 3828 if (a->endpoints[lowerNra] < b->endpoints[lowerNrb])3829 return true;3830 else if (a->endpoints[lowerNra] > b->endpoints[lowerNrb])3831 return false;3832 else { // both lower-numbered endpoints are the same ...3833 if (a->endpoints[(lowerNra+1)%2] < b->endpoints[(lowerNrb+1)%2])3834 return true;3835 else if (a->endpoints[(lowerNra+1)%2] > b->endpoints[(lowerNrb+1)%2])3836 return false;3837 }3838 return false;3839 };3840 };3841 3842 #define UniqueLines set < class BoundaryLineSet *, BoundaryLineSetCompare>3843 3844 3424 /** 3845 3425 * Finds all degenerated lines within the tesselation structure. … … 3850 3430 map<int, int> * Tesselation::FindAllDegeneratedLines() 3851 3431 { 3852 Info FunctionInfo(__func__); 3853 UniqueLines AllLines; 3432 map<int, class BoundaryLineSet *> AllLines; 3854 3433 map<int, int> * DegeneratedLines = new map<int, int>; 3855 3434 3856 3435 // sanity check 3857 3436 if (LinesOnBoundary.empty()) { 3858 eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.";3437 Log() << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure."; 3859 3438 return DegeneratedLines; 3860 3439 } 3861 3440 3862 3441 LineMap::iterator LineRunner1; 3863 pair< UniqueLines::iterator, bool> tester;3442 pair<LineMap::iterator, bool> tester; 3864 3443 for (LineRunner1 = LinesOnBoundary.begin(); LineRunner1 != LinesOnBoundary.end(); ++LineRunner1) { 3865 tester = AllLines.insert( LineRunner1->second);3866 if ( !tester.second) { // found degenerated line3867 DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, (*tester.first)->Nr) );3868 DegeneratedLines->insert ( pair<int, int> ( (*tester.first)->Nr, LineRunner1->second->Nr) );3444 tester = AllLines.insert( pair<int,BoundaryLineSet *> (LineRunner1->second->endpoints[0]->Nr, LineRunner1->second) ); 3445 if ((!tester.second) && (tester.first->second->endpoints[1]->Nr == LineRunner1->second->endpoints[1]->Nr)) { // found degenerated line 3446 DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, tester.first->second->Nr) ); 3447 DegeneratedLines->insert ( pair<int, int> (tester.first->second->Nr, LineRunner1->second->Nr) ); 3869 3448 } 3870 3449 } … … 3872 3451 AllLines.clear(); 3873 3452 3874 Log() << Verbose( 0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;3453 Log() << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl; 3875 3454 map<int,int>::iterator it; 3876 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) { 3877 const LineMap::const_iterator Line1 = LinesOnBoundary.find((*it).first); 3878 const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second); 3879 if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end()) 3880 Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl; 3881 else 3882 eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl; 3883 } 3455 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) 3456 Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl; 3884 3457 3885 3458 return DegeneratedLines; … … 3894 3467 map<int, int> * Tesselation::FindAllDegeneratedTriangles() 3895 3468 { 3896 Info FunctionInfo(__func__);3897 3469 map<int, int> * DegeneratedLines = FindAllDegeneratedLines(); 3898 3470 map<int, int> * DegeneratedTriangles = new map<int, int>; … … 3922 3494 delete(DegeneratedLines); 3923 3495 3924 Log() << Verbose( 0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;3496 Log() << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl; 3925 3497 map<int,int>::iterator it; 3926 3498 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3927 Log() << Verbose( 0) << (*it).first << " => " << (*it).second << endl;3499 Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl; 3928 3500 3929 3501 return DegeneratedTriangles; … … 3936 3508 void Tesselation::RemoveDegeneratedTriangles() 3937 3509 { 3938 Info FunctionInfo(__func__);3939 3510 map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles(); 3940 3511 TriangleMap::iterator finder; 3941 3512 BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL; 3942 3513 int count = 0; 3514 3515 Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl; 3943 3516 3944 3517 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); … … 3999 3572 // erase the pair 4000 3573 count += (int) DegeneratedTriangles->erase(triangle->Nr); 4001 Log() << Verbose( 0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;3574 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl; 4002 3575 RemoveTesselationTriangle(triangle); 4003 3576 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 4004 Log() << Verbose( 0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;3577 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl; 4005 3578 RemoveTesselationTriangle(partnerTriangle); 4006 3579 } else { 4007 Log() << Verbose( 0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle3580 Log() << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle 4008 3581 << " and its partner " << *partnerTriangle << " because it is essential for at" 4009 3582 << " least one of the endpoints to be kept in the tesselation structure." << endl; … … 4011 3584 } 4012 3585 delete(DegeneratedTriangles); 4013 if (count > 0) 4014 LastTriangle = NULL; 4015 4016 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3586 3587 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3588 Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl; 4017 3589 } 4018 3590 … … 4027 3599 void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC) 4028 3600 { 4029 Info FunctionInfo(__func__); 3601 Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl; 3602 4030 3603 // find nearest boundary point 4031 3604 class TesselPoint *BackupPoint = NULL; … … 4043 3616 return; 4044 3617 } 4045 Log() << Verbose( 0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;3618 Log() << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl; 4046 3619 4047 3620 // go through its lines and find the best one to split … … 4076 3649 4077 3650 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 4078 Log() << Verbose( 2) << "Adding new triangle points."<< endl;3651 Log() << Verbose(5) << "Adding new triangle points."<< endl; 4079 3652 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 4080 3653 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 4081 3654 AddTesselationPoint(point, 2); 4082 Log() << Verbose( 2) << "Adding new triangle lines."<< endl;3655 Log() << Verbose(5) << "Adding new triangle lines."<< endl; 4083 3656 AddTesselationLine(TPS[0], TPS[1], 0); 4084 3657 AddTesselationLine(TPS[0], TPS[2], 1); … … 4087 3660 BTS->GetNormalVector(TempTriangle->NormalVector); 4088 3661 BTS->NormalVector.Scale(-1.); 4089 Log() << Verbose( 1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;3662 Log() << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl; 4090 3663 AddTesselationTriangle(); 4091 3664 4092 3665 // create other side of this triangle and close both new sides of the first created triangle 4093 Log() << Verbose( 2) << "Adding new triangle points."<< endl;3666 Log() << Verbose(5) << "Adding new triangle points."<< endl; 4094 3667 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 4095 3668 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 4096 3669 AddTesselationPoint(point, 2); 4097 Log() << Verbose( 2) << "Adding new triangle lines."<< endl;3670 Log() << Verbose(5) << "Adding new triangle lines."<< endl; 4098 3671 AddTesselationLine(TPS[0], TPS[1], 0); 4099 3672 AddTesselationLine(TPS[0], TPS[2], 1); … … 4101 3674 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 4102 3675 BTS->GetNormalVector(TempTriangle->NormalVector); 4103 Log() << Verbose( 1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;3676 Log() << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl; 4104 3677 AddTesselationTriangle(); 4105 3678 … … 4108 3681 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 4109 3682 if (BestLine == BTS->lines[i]){ 4110 eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl;4111 performCriticalExit();3683 Log() << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl; 3684 exit(255); 4112 3685 } 4113 3686 BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) ); … … 4116 3689 } 4117 3690 } 3691 3692 // exit 3693 Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl; 4118 3694 }; 4119 3695 … … 4125 3701 void Tesselation::Output(const char *filename, const PointCloud * const cloud) 4126 3702 { 4127 Info FunctionInfo(__func__);4128 3703 ofstream *tempstream = NULL; 4129 3704 string NameofTempFile; … … 4138 3713 NameofTempFile.erase(npos, 1); 4139 3714 NameofTempFile.append(TecplotSuffix); 4140 Log() << Verbose( 0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3715 Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 4141 3716 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 4142 3717 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 4152 3727 NameofTempFile.erase(npos, 1); 4153 3728 NameofTempFile.append(Raster3DSuffix); 4154 Log() << Verbose( 0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3729 Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 4155 3730 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 4156 3731 WriteRaster3dFile(tempstream, this, cloud); … … 4164 3739 TriangleFilesWritten++; 4165 3740 }; 4166 4167 struct BoundaryPolygonSetCompare {4168 bool operator()(const BoundaryPolygonSet * s1, const BoundaryPolygonSet * s2) const {4169 if (s1->endpoints.size() < s2->endpoints.size())4170 return true;4171 else if (s1->endpoints.size() > s2->endpoints.size())4172 return false;4173 else { // equality of number of endpoints4174 PointSet::const_iterator Walker1 = s1->endpoints.begin();4175 PointSet::const_iterator Walker2 = s2->endpoints.begin();4176 while ((Walker1 != s1->endpoints.end()) || (Walker2 != s2->endpoints.end())) {4177 if ((*Walker1)->Nr < (*Walker2)->Nr)4178 return true;4179 else if ((*Walker1)->Nr > (*Walker2)->Nr)4180 return false;4181 Walker1++;4182 Walker2++;4183 }4184 return false;4185 }4186 }4187 };4188 4189 #define UniquePolygonSet set < BoundaryPolygonSet *, BoundaryPolygonSetCompare>4190 4191 /** Finds all degenerated polygons and calls ReTesselateDegeneratedPolygon()/4192 * \return number of polygons found4193 */4194 int Tesselation::CorrectAllDegeneratedPolygons()4195 {4196 Info FunctionInfo(__func__);4197 4198 /// 2. Go through all BoundaryPointSet's, check their triangles' NormalVector4199 map <int, int> *DegeneratedTriangles = FindAllDegeneratedTriangles();4200 set < BoundaryPointSet *> EndpointCandidateList;4201 pair < set < BoundaryPointSet *>::iterator, bool > InsertionTester;4202 pair < map < int, Vector *>::iterator, bool > TriangleInsertionTester;4203 for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) {4204 Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl;4205 map < int, Vector *> TriangleVectors;4206 // gather all NormalVectors4207 Log() << Verbose(1) << "Gathering triangles ..." << endl;4208 for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++)4209 for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) {4210 if (DegeneratedTriangles->find(TriangleRunner->second->Nr) == DegeneratedTriangles->end()) {4211 TriangleInsertionTester = TriangleVectors.insert( pair< int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)) );4212 if (TriangleInsertionTester.second)4213 Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;4214 } else {4215 Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl;4216 }4217 }4218 // check whether there are two that are parallel4219 Log() << Verbose(1) << "Finding two parallel triangles ..." << endl;4220 for (map < int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++)4221 for (map < int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++)4222 if (VectorWalker != VectorRunner) { // skip equals4223 const double SCP = VectorWalker->second->ScalarProduct(VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles4224 Log() << Verbose(1) << "Checking " << *VectorWalker->second<< " against " << *VectorRunner->second << ": " << SCP << endl;4225 if (fabs(SCP + 1.) < ParallelEpsilon) {4226 InsertionTester = EndpointCandidateList.insert((Runner->second));4227 if (InsertionTester.second)4228 Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl;4229 // and break out of both loops4230 VectorWalker = TriangleVectors.end();4231 VectorRunner = TriangleVectors.end();4232 break;4233 }4234 }4235 }4236 4237 /// 3. Find connected endpoint candidates and put them into a polygon4238 UniquePolygonSet ListofDegeneratedPolygons;4239 BoundaryPointSet *Walker = NULL;4240 BoundaryPointSet *OtherWalker = NULL;4241 BoundaryPolygonSet *Current = NULL;4242 stack <BoundaryPointSet*> ToCheckConnecteds;4243 while (!EndpointCandidateList.empty()) {4244 Walker = *(EndpointCandidateList.begin());4245 if (Current == NULL) { // create a new polygon with current candidate4246 Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl;4247 Current = new BoundaryPolygonSet;4248 Current->endpoints.insert(Walker);4249 EndpointCandidateList.erase(Walker);4250 ToCheckConnecteds.push(Walker);4251 }4252 4253 // go through to-check stack4254 while (!ToCheckConnecteds.empty()) {4255 Walker = ToCheckConnecteds.top(); // fetch ...4256 ToCheckConnecteds.pop(); // ... and remove4257 for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) {4258 OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker);4259 Log() << Verbose(1) << "Checking " << *OtherWalker << endl;4260 set < BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker);4261 if (Finder != EndpointCandidateList.end()) { // found a connected partner4262 Log() << Verbose(1) << " Adding to polygon." << endl;4263 Current->endpoints.insert(OtherWalker);4264 EndpointCandidateList.erase(Finder); // remove from candidates4265 ToCheckConnecteds.push(OtherWalker); // but check its partners too4266 } else {4267 Log() << Verbose(1) << " is not connected to " << *Walker << endl;4268 }4269 }4270 }4271 4272 Log() << Verbose(0) << "Final polygon is " << *Current << endl;4273 ListofDegeneratedPolygons.insert(Current);4274 Current = NULL;4275 }4276 4277 const int counter = ListofDegeneratedPolygons.size();4278 4279 Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl;4280 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++)4281 Log() << Verbose(0) << " " << **PolygonRunner << endl;4282 4283 /// 4. Go through all these degenerated polygons4284 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) {4285 stack <int> TriangleNrs;4286 Vector NormalVector;4287 /// 4a. Gather all triangles of this polygon4288 TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints();4289 4290 if (T->size() == 2) {4291 Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;4292 delete(T);4293 continue;4294 }4295 4296 TriangleSet::iterator TriangleWalker = T->begin(); // is the inner iterator4297 /// 4a. Get NormalVector for one side (this is "front")4298 NormalVector.CopyVector(&(*TriangleWalker)->NormalVector);4299 Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl;4300 TriangleWalker++;4301 TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator4302 /// 4b. Remove all triangles whose NormalVector is in opposite direction (i.e. "back")4303 BoundaryTriangleSet *triangle = NULL;4304 while (TriangleSprinter != T->end()) {4305 TriangleWalker = TriangleSprinter;4306 triangle = *TriangleWalker;4307 TriangleSprinter++;4308 Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl;4309 if (triangle->NormalVector.ScalarProduct(&NormalVector) < 0) { // if from other side, then delete and remove from list4310 Log() << Verbose(1) << " Removing ... " << endl;4311 TriangleNrs.push(triangle->Nr);4312 T->erase(TriangleWalker);4313 RemoveTesselationTriangle(triangle);4314 } else4315 Log() << Verbose(1) << " Keeping ... " << endl;4316 }4317 /// 4c. Copy all "front" triangles but with inverse NormalVector4318 TriangleWalker = T->begin();4319 while (TriangleWalker != T->end()) { // go through all front triangles4320 Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl;4321 for (int i = 0; i < 3; i++)4322 AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i);4323 AddTesselationLine(TPS[0], TPS[1], 0);4324 AddTesselationLine(TPS[0], TPS[2], 1);4325 AddTesselationLine(TPS[1], TPS[2], 2);4326 if (TriangleNrs.empty())4327 eLog() << Verbose(0) << "No more free triangle numbers!" << endl;4328 BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ...4329 AddTesselationTriangle(); // ... and add4330 TriangleNrs.pop();4331 BTS->NormalVector.CopyVector(&(*TriangleWalker)->NormalVector);4332 BTS->NormalVector.Scale(-1.);4333 TriangleWalker++;4334 }4335 if (!TriangleNrs.empty()) {4336 eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl;4337 }4338 delete(T); // remove the triangleset4339 }4340 4341 map<int, int> * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles();4342 Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl;4343 map<int,int>::iterator it;4344 for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++)4345 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;4346 delete(SimplyDegeneratedTriangles);4347 4348 /// 5. exit4349 UniquePolygonSet::iterator PolygonRunner;4350 while (!ListofDegeneratedPolygons.empty()) {4351 PolygonRunner = ListofDegeneratedPolygons.begin();4352 delete(*PolygonRunner);4353 ListofDegeneratedPolygons.erase(PolygonRunner);4354 }4355 4356 return counter;4357 }; -
src/tesselation.hpp
r0b2dd2 r482373 23 23 #include <list> 24 24 #include <set> 25 #include <stack>26 25 27 26 #include "atom_particleinfo.hpp" … … 48 47 #define VRMLSUffix ".wrl" 49 48 50 #define ParallelEpsilon 1e-351 52 49 // ======================================================= some template functions ========================================= 53 50 54 51 #define PointMap map < int, class BoundaryPointSet * > 55 #define PointSet set < class BoundaryPointSet * >56 #define PointList list < class BoundaryPointSet * >57 52 #define PointPair pair < int, class BoundaryPointSet * > 58 53 #define PointTestPair pair < PointMap::iterator, bool > 59 60 54 #define CandidateList list <class CandidateForTesselation *> 61 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>62 55 63 56 #define LineMap multimap < int, class BoundaryLineSet * > 64 #define LineSet set < class BoundaryLineSet * >65 #define LineList list < class BoundaryLineSet * >66 57 #define LinePair pair < int, class BoundaryLineSet * > 67 58 #define LineTestPair pair < LineMap::iterator, bool > 68 59 69 60 #define TriangleMap map < int, class BoundaryTriangleSet * > 70 #define TriangleSet set < class BoundaryTriangleSet * >71 #define TriangleList list < class BoundaryTriangleSet * >72 61 #define TrianglePair pair < int, class BoundaryTriangleSet * > 73 62 #define TriangleTestPair pair < TrianglePair::iterator, bool > 74 63 75 #define PolygonMap map < int, class BoundaryPolygonSet * >76 #define PolygonSet set < class BoundaryPolygonSet * >77 #define PolygonList list < class BoundaryPolygonSet * >78 79 64 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> > 80 65 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> > 81 82 #define TesselPointList list <TesselPoint *>83 #define TesselPointSet set <TesselPoint *>84 66 85 67 /********************************************** declarations *******************************/ … … 132 114 TriangleMap triangles; 133 115 int Nr; 134 bool skipped;135 116 }; 136 117 … … 158 139 class BoundaryLineSet *lines[3]; 159 140 Vector NormalVector; 160 Vector SphereCenter;161 141 int Nr; 162 142 }; 163 143 164 144 ostream & operator << (ostream &ost, const BoundaryTriangleSet &a); 165 166 167 // ======================================================== class BoundaryTriangleSet =======================================168 169 /** Set of BoundaryPointSet.170 * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has171 * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation172 * class (i.e. no allocation, no deletion).173 * \note we assume that the set of endpoints reside (more or less) on a plane.174 */175 class BoundaryPolygonSet {176 public:177 BoundaryPolygonSet();178 ~BoundaryPolygonSet();179 180 Vector * GetNormalVector(const Vector &NormalVector) const;181 void GetCenter(Vector *center) const;182 bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;183 bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;184 bool ContainsBoundaryPoint(const TesselPoint * const point) const;185 bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;186 bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;187 bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;188 bool ContainsPresentTupel(const PointSet &endpoints) const;189 TriangleSet * GetAllContainedTrianglesFromEndpoints() const;190 bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);191 192 PointSet endpoints;193 int Nr;194 };195 196 ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);197 145 198 146 // =========================================================== class TESSELPOINT =========================================== … … 222 170 virtual ~PointCloud(); 223 171 224 virtual const char * const GetName() const { return "unknown"; };225 172 virtual Vector *GetCenter() const { return NULL; }; 226 173 virtual TesselPoint *GetPoint() const { return NULL; }; … … 230 177 virtual void GoToFirst() const {}; 231 178 virtual void GoToLast() const {}; 232 virtual bool IsEmpty() const { return true; };233 virtual bool IsEnd() const { return true; };179 virtual bool IsEmpty() const { return false; }; 180 virtual bool IsEnd() const { return false; }; 234 181 }; 235 182 … … 238 185 class CandidateForTesselation { 239 186 public : 240 CandidateForTesselation(BoundaryLineSet* currentBaseLine);241 187 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter); 242 188 ~CandidateForTesselation(); 243 189 244 TesselPoint List pointlist;190 TesselPoint *point; 245 191 BoundaryLineSet *BaseLine; 246 192 Vector OptCenter; 247 193 Vector OtherOptCenter; 248 bool IsDegenerated; 249 double ShortestAngle; 250 double OtherShortestAngle; 251 }; 252 253 ostream & operator <<(ostream &ost, const CandidateForTesselation &a); 194 }; 254 195 255 196 // =========================================================== class TESSELATION =========================================== … … 269 210 void AddTesselationTriangle(); 270 211 void AddTesselationTriangle(const int nr); 271 void AddCandidateTriangle(CandidateForTesselation CandidateLine);272 212 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle); 273 213 void RemoveTesselationLine(class BoundaryLineSet *line); … … 278 218 void FindStartingTriangle(const double RADIUS, const LinkedCell *LC); 279 219 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC); 280 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;281 bool FindNextSuitableTriangle( CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);220 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const; 221 bool FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC); 282 222 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const; 283 223 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]); … … 295 235 void RemoveDegeneratedTriangles(); 296 236 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC); 297 int CorrectAllDegeneratedPolygons();298 237 299 238 set<TesselPoint*> * GetAllConnectedPoints(const TesselPoint* const Point) const; … … 301 240 list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const; 302 241 list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const; 303 list<TesselPoint*> * GetCircleOf SetOfPoints(set<TesselPoint*> *SetOfNeighbours,const TesselPoint* const Point, const Vector * const Reference = NULL) const;242 list<TesselPoint*> * GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const; 304 243 class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const; 305 244 list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const; … … 320 259 PointMap PointsOnBoundary; 321 260 LineMap LinesOnBoundary; 322 CandidateMap OpenLines;323 261 TriangleMap TrianglesOnBoundary; 324 262 int PointsOnBoundaryCount; … … 348 286 mutable PointMap::const_iterator InternalPointer; 349 287 350 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;288 bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const; 351 289 }; 352 290 -
src/tesselationhelpers.cpp
r0b2dd2 r482373 8 8 #include <fstream> 9 9 10 #include "info.hpp"11 10 #include "linkedcell.hpp" 12 11 #include "log.hpp" … … 16 15 #include "verbose.hpp" 17 16 18 double DetGet(gsl_matrix * const A, const int inPlace) 19 { 20 Info FunctionInfo(__func__); 17 double DetGet(gsl_matrix * const A, const int inPlace) { 21 18 /* 22 19 inPlace = 1 => A is replaced with the LU decomposed copy. … … 48 45 void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS) 49 46 { 50 Info FunctionInfo(__func__);51 47 gsl_matrix *A = gsl_matrix_calloc(3,3); 52 48 double m11, m12, m13, m14; … … 115 111 const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius) 116 112 { 117 Info FunctionInfo(__func__);118 113 Vector TempNormal, helper; 119 114 double Restradius; 120 115 Vector OtherCenter; 116 Log() << Verbose(3) << "Begin of GetCenterOfSphere.\n"; 121 117 Center->Zero(); 122 118 helper.CopyVector(&a); … … 132 128 Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma))); 133 129 NewUmkreismittelpunkt->CopyVector(Center); 134 Log() << Verbose( 1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";130 Log() << Verbose(4) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n"; 135 131 // Here we calculated center of circumscribing circle, using barycentric coordinates 136 Log() << Verbose( 1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";132 Log() << Verbose(4) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n"; 137 133 138 134 TempNormal.CopyVector(&a); … … 158 154 TempNormal.Normalize(); 159 155 Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius); 160 Log() << Verbose( 1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";156 Log() << Verbose(4) << "Height of center of circumference to center of sphere is " << Restradius << ".\n"; 161 157 TempNormal.Scale(Restradius); 162 Log() << Verbose( 1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";158 Log() << Verbose(4) << "Shift vector to sphere of circumference is " << TempNormal << ".\n"; 163 159 164 160 Center->AddVector(&TempNormal); 165 Log() << Verbose( 1) << "Center of sphere of circumference is " << *Center << ".\n";161 Log() << Verbose(0) << "Center of sphere of circumference is " << *Center << ".\n"; 166 162 GetSphere(&OtherCenter, a, b, c, RADIUS); 167 Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n"; 163 Log() << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n"; 164 Log() << Verbose(3) << "End of GetCenterOfSphere.\n"; 168 165 }; 169 166 … … 177 174 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c) 178 175 { 179 Info FunctionInfo(__func__);180 176 Vector helper; 181 177 double alpha, beta, gamma; … … 190 186 beta = M_PI - SideC.Angle(&SideA); 191 187 gamma = M_PI - SideA.Angle(&SideB); 192 //Log() << Verbose( 1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;188 //Log() << Verbose(3) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl; 193 189 if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) { 194 eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl; 190 eLog() << Verbose(0) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl; 191 performCriticalExit(); 195 192 } 196 193 … … 223 220 double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection) 224 221 { 225 Info FunctionInfo(__func__);226 222 Vector helper; 227 223 double radius, alpha; 228 Vector RelativeOldSphereCenter; 229 Vector RelativeNewSphereCenter; 230 231 RelativeOldSphereCenter.CopyVector(&OldSphereCenter); 232 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 233 RelativeNewSphereCenter.CopyVector(&NewSphereCenter); 234 RelativeNewSphereCenter.SubtractVector(&CircleCenter); 235 helper.CopyVector(&RelativeNewSphereCenter); 224 225 helper.CopyVector(&NewSphereCenter); 236 226 // test whether new center is on the parameter circle's plane 237 227 if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { … … 239 229 helper.ProjectOntoPlane(&CirclePlaneNormal); 240 230 } 241 radius = helper. NormSquared();231 radius = helper.ScalarProduct(&helper); 242 232 // test whether the new center vector has length of CircleRadius 243 233 if (fabs(radius - CircleRadius) > HULLEPSILON) 244 234 eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl; 245 alpha = helper.Angle(& RelativeOldSphereCenter);235 alpha = helper.Angle(&OldSphereCenter); 246 236 // make the angle unique by checking the halfplanes/search direction 247 237 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON) // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals 248 238 alpha = 2.*M_PI - alpha; 249 Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl;250 radius = helper.Distance(& RelativeOldSphereCenter);239 //Log() << Verbose(2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl; 240 radius = helper.Distance(&OldSphereCenter); 251 241 helper.ProjectOntoPlane(&NormalVector); 252 242 // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles 253 243 if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) { 254 Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;244 //Log() << Verbose(2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl; 255 245 return alpha; 256 246 } else { 257 Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl;247 //Log() << Verbose(1) << "INFO: NewSphereCenter " << helper << " is too close to OldSphereCenter" << OldSphereCenter << "." << endl; 258 248 return 2.*M_PI; 259 249 } … … 275 265 double MinIntersectDistance(const gsl_vector * x, void *params) 276 266 { 277 Info FunctionInfo(__func__);278 267 double retval = 0; 279 268 struct Intersection *I = (struct Intersection *)params; … … 296 285 297 286 retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB); 298 //Log() << Verbose( 1) << "MinIntersectDistance called, result: " << retval << endl;287 //Log() << Verbose(2) << "MinIntersectDistance called, result: " << retval << endl; 299 288 300 289 return retval; … … 316 305 bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4) 317 306 { 318 Info FunctionInfo(__func__);319 307 bool result; 320 308 … … 364 352 365 353 if (status == GSL_SUCCESS) { 366 Log() << Verbose( 1) << "converged to minimum" << endl;354 Log() << Verbose(2) << "converged to minimum" << endl; 367 355 } 368 356 } while (status == GSL_CONTINUE && iter < 100); … … 389 377 t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB); 390 378 391 Log() << Verbose( 1) << "Intersection " << intersection << " is at "379 Log() << Verbose(2) << "Intersection " << intersection << " is at " 392 380 << t1 << " for (" << point1 << "," << point2 << ") and at " 393 381 << t2 << " for (" << point3 << "," << point4 << "): "; 394 382 395 383 if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) { 396 Log() << Verbose( 1) << "true intersection." << endl;384 Log() << Verbose(0) << "true intersection." << endl; 397 385 result = true; 398 386 } else { 399 Log() << Verbose( 1) << "intersection out of region of interest." << endl;387 Log() << Verbose(0) << "intersection out of region of interest." << endl; 400 388 result = false; 401 389 } … … 420 408 double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector) 421 409 { 422 Info FunctionInfo(__func__);423 410 if (reference.IsZero()) 424 411 return M_PI; … … 432 419 } 433 420 434 Log() << Verbose( 1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;421 Log() << Verbose(4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl; 435 422 436 423 return phi; … … 447 434 double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d) 448 435 { 449 Info FunctionInfo(__func__);450 436 Vector Point, TetraederVector[3]; 451 437 double volume; … … 471 457 bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]) 472 458 { 473 Info FunctionInfo(__func__);474 459 bool result = false; 475 460 int counter = 0; … … 498 483 } 499 484 if ((!result) && (counter > 1)) { 500 Log() << Verbose( 1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;485 Log() << Verbose(2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl; 501 486 result = true; 502 487 } … … 505 490 506 491 507 ///** Sort function for the candidate list. 508 // */ 509 //bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 510 //{ 511 // Info FunctionInfo(__func__); 512 // Vector BaseLineVector, OrthogonalVector, helper; 513 // if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 514 // eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 515 // //return false; 516 // exit(1); 517 // } 518 // // create baseline vector 519 // BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 520 // BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 521 // BaseLineVector.Normalize(); 522 // 523 // // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!) 524 // helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 525 // helper.SubtractVector(candidate1->point->node); 526 // OrthogonalVector.CopyVector(&helper); 527 // helper.VectorProduct(&BaseLineVector); 528 // OrthogonalVector.SubtractVector(&helper); 529 // OrthogonalVector.Normalize(); 530 // 531 // // calculate both angles and correct with in-plane vector 532 // helper.CopyVector(candidate1->point->node); 533 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 534 // double phi = BaseLineVector.Angle(&helper); 535 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 536 // phi = 2.*M_PI - phi; 537 // } 538 // helper.CopyVector(candidate2->point->node); 539 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 540 // double psi = BaseLineVector.Angle(&helper); 541 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 542 // psi = 2.*M_PI - psi; 543 // } 544 // 545 // Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl; 546 // Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl; 547 // 548 // // return comparison 549 // return phi < psi; 550 //}; 492 /** Sort function for the candidate list. 493 */ 494 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 495 { 496 Vector BaseLineVector, OrthogonalVector, helper; 497 if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 498 eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 499 //return false; 500 exit(1); 501 } 502 // create baseline vector 503 BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 504 BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 505 BaseLineVector.Normalize(); 506 507 // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!) 508 helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 509 helper.SubtractVector(candidate1->point->node); 510 OrthogonalVector.CopyVector(&helper); 511 helper.VectorProduct(&BaseLineVector); 512 OrthogonalVector.SubtractVector(&helper); 513 OrthogonalVector.Normalize(); 514 515 // calculate both angles and correct with in-plane vector 516 helper.CopyVector(candidate1->point->node); 517 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 518 double phi = BaseLineVector.Angle(&helper); 519 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 520 phi = 2.*M_PI - phi; 521 } 522 helper.CopyVector(candidate2->point->node); 523 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 524 double psi = BaseLineVector.Angle(&helper); 525 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 526 psi = 2.*M_PI - psi; 527 } 528 529 Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl; 530 Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl; 531 532 // return comparison 533 return phi < psi; 534 }; 551 535 552 536 /** … … 560 544 TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC) 561 545 { 562 Info FunctionInfo(__func__);563 546 TesselPoint* closestPoint = NULL; 564 547 TesselPoint* secondClosestPoint = NULL; … … 571 554 for(int i=0;i<NDIM;i++) // store indices of this cell 572 555 N[i] = LC->n[i]; 573 Log() << Verbose( 1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;556 Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 574 557 575 558 LC->GetNeighbourBounds(Nlower, Nupper); 576 //Log() << Verbose( 1) << endl;559 //Log() << Verbose(0) << endl; 577 560 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 578 561 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 579 562 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 580 563 const LinkedNodes *List = LC->GetCurrentCell(); 581 //Log() << Verbose( 1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;564 //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 582 565 if (List != NULL) { 583 566 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 615 598 TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC) 616 599 { 617 Info FunctionInfo(__func__);618 600 TesselPoint* closestPoint = NULL; 619 601 SecondPoint = NULL; … … 626 608 for(int i=0;i<NDIM;i++) // store indices of this cell 627 609 N[i] = LC->n[i]; 628 Log() << Verbose( 1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;610 Log() << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 629 611 630 612 LC->GetNeighbourBounds(Nlower, Nupper); 631 //Log() << Verbose( 1) << endl;613 //Log() << Verbose(0) << endl; 632 614 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 633 615 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 634 616 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 635 617 const LinkedNodes *List = LC->GetCurrentCell(); 636 //Log() << Verbose( 1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;618 //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 637 619 if (List != NULL) { 638 620 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 645 627 distance = currentNorm; 646 628 closestPoint = (*Runner); 647 //Log() << Verbose( 1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;629 //Log() << Verbose(2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl; 648 630 } else if (currentNorm < secondDistance) { 649 631 secondDistance = currentNorm; 650 632 SecondPoint = (*Runner); 651 //Log() << Verbose( 1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;633 //Log() << Verbose(2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl; 652 634 } 653 635 } … … 659 641 // output 660 642 if (closestPoint != NULL) { 661 Log() << Verbose( 1) << "Closest point is " << *closestPoint;643 Log() << Verbose(2) << "Closest point is " << *closestPoint; 662 644 if (SecondPoint != NULL) 663 645 Log() << Verbose(0) << " and second closest is " << *SecondPoint; … … 675 657 Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase) 676 658 { 677 Info FunctionInfo(__func__);678 659 // construct the plane of the two baselines (i.e. take both their directional vectors) 679 660 Vector Normal; … … 686 667 Normal.VectorProduct(&OtherBaseline); 687 668 Normal.Normalize(); 688 Log() << Verbose( 1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;669 Log() << Verbose(4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl; 689 670 690 671 // project one offset point of OtherBase onto this plane (and add plane offset vector) … … 703 684 Normal.CopyVector(Intersection); 704 685 Normal.SubtractVector(Base->endpoints[0]->node->node); 705 Log() << Verbose( 1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;686 Log() << Verbose(3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl; 706 687 707 688 return Intersection; … … 716 697 double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle) 717 698 { 718 Info FunctionInfo(__func__);719 699 double distance = 0.; 720 700 if (x == NULL) { … … 733 713 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud) 734 714 { 735 Info FunctionInfo(__func__);736 715 TesselPoint *Walker = NULL; 737 716 int i; … … 777 756 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 778 757 { 779 Info FunctionInfo(__func__);780 758 Vector helper; 781 782 if (Tess->LastTriangle != NULL) { 783 // include the current position of the virtual sphere in the temporary raster3d file 784 Vector *center = cloud->GetCenter(); 785 // make the circumsphere's center absolute again 786 helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node); 787 helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node); 788 helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node); 789 helper.Scale(1./3.); 790 helper.SubtractVector(center); 791 // and add to file plus translucency object 792 *rasterfile << "# current virtual sphere\n"; 793 *rasterfile << "8\n 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0\n"; 794 *rasterfile << "2\n " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n"; 795 *rasterfile << "9\n terminating special property\n"; 796 delete(center); 797 } 759 // include the current position of the virtual sphere in the temporary raster3d file 760 Vector *center = cloud->GetCenter(); 761 // make the circumsphere's center absolute again 762 helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node); 763 helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node); 764 helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node); 765 helper.Scale(1./3.); 766 helper.SubtractVector(center); 767 // and add to file plus translucency object 768 *rasterfile << "# current virtual sphere\n"; 769 *rasterfile << "8\n 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0\n"; 770 *rasterfile << "2\n " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n"; 771 *rasterfile << "9\n terminating special property\n"; 772 delete(center); 798 773 }; 799 774 … … 806 781 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 807 782 { 808 Info FunctionInfo(__func__);809 783 TesselPoint *Walker = NULL; 810 784 int i; … … 852 826 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N) 853 827 { 854 Info FunctionInfo(__func__);855 828 if ((tecplot != NULL) && (TesselStruct != NULL)) { 856 829 // write header 857 830 *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl; 858 831 *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\" \"U\"" << endl; 859 *tecplot << "ZONE T=\""; 860 if (N < 0) { 861 *tecplot << cloud->GetName(); 862 } else { 863 *tecplot << N << "-"; 864 for (int i=0;i<3;i++) 865 *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name; 866 } 832 *tecplot << "ZONE T=\"" << N << "-"; 833 for (int i=0;i<3;i++) 834 *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name; 867 835 *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl; 868 836 int i=0; … … 873 841 874 842 // print atom coordinates 843 Log() << Verbose(2) << "The following triangles were created:"; 875 844 int Counter = 1; 876 845 TesselPoint *Walker = NULL; … … 882 851 *tecplot << endl; 883 852 // print connectivity 884 Log() << Verbose(1) << "The following triangles were created:" << endl;885 853 for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 886 Log() << Verbose( 1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl;854 Log() << Verbose(0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name; 887 855 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl; 888 856 } 889 857 delete[] (LookupList); 858 Log() << Verbose(0) << endl; 890 859 } 891 860 }; … … 898 867 void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct) 899 868 { 900 Info FunctionInfo(__func__);901 869 class BoundaryPointSet *point = NULL; 902 870 class BoundaryLineSet *line = NULL; 903 871 872 //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl; 904 873 // calculate remaining concavity 905 874 for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { … … 909 878 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 910 879 line = LineRunner->second; 911 //Log() << Verbose( 1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;880 //Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 912 881 if (!line->CheckConvexityCriterion()) 913 882 point->value += 1; 914 883 } 915 884 } 885 //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl; 916 886 }; 917 887 … … 924 894 bool CheckListOfBaselines(const Tesselation * const TesselStruct) 925 895 { 926 Info FunctionInfo(__func__);927 896 LineMap::const_iterator testline; 928 897 bool result = false; … … 932 901 for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) { 933 902 if (testline->second->triangles.size() != 2) { 934 Log() << Verbose( 2) << *testline->second << "\t" << testline->second->triangles.size() << endl;903 Log() << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl; 935 904 counter++; 936 905 } … … 943 912 } 944 913 945 /** Counts the number of triangle pairs that contain the given polygon.946 * \param *P polygon with endpoints to look for947 * \param *T set of triangles to create pairs from containing \a *P948 */949 int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T)950 {951 Info FunctionInfo(__func__);952 // check number of endpoints in *P953 if (P->endpoints.size() != 4) {954 eLog() << Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl;955 return 0;956 }957 958 // check number of triangles in *T959 if (T->size() < 2) {960 eLog() << Verbose(1) << "Not enough triangles to have pairs!" << endl;961 return 0;962 }963 964 Log() << Verbose(0) << "Polygon is " << *P << endl;965 // create each pair, get the endpoints and check whether *P is contained.966 int counter = 0;967 PointSet Trianglenodes;968 class BoundaryPolygonSet PairTrianglenodes;969 for(TriangleSet::iterator Walker = T->begin(); Walker != T->end(); Walker++) {970 for (int i=0;i<3;i++)971 Trianglenodes.insert((*Walker)->endpoints[i]);972 973 for(TriangleSet::iterator PairWalker = Walker; PairWalker != T->end(); PairWalker++) {974 if (Walker != PairWalker) { // skip first975 PairTrianglenodes.endpoints = Trianglenodes;976 for (int i=0;i<3;i++)977 PairTrianglenodes.endpoints.insert((*PairWalker)->endpoints[i]);978 const int size = PairTrianglenodes.endpoints.size();979 if (size == 4) {980 Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl;981 // now check982 if (PairTrianglenodes.ContainsPresentTupel(P)) {983 counter++;984 Log() << Verbose(0) << " ACCEPT: Matches with " << *P << endl;985 } else {986 Log() << Verbose(0) << " REJECT: No match with " << *P << endl;987 }988 } else {989 Log() << Verbose(0) << " REJECT: Less than four endpoints." << endl;990 }991 }992 }993 Trianglenodes.clear();994 }995 return counter;996 };997 998 /** Checks whether two give polygons have two or more points in common.999 * \param *P1 first polygon1000 * \param *P2 second polygon1001 * \return true - are connected, false = are note1002 */1003 bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2)1004 {1005 Info FunctionInfo(__func__);1006 int counter = 0;1007 for(PointSet::const_iterator Runner = P1->endpoints.begin(); Runner != P1->endpoints.end(); Runner++) {1008 if (P2->ContainsBoundaryPoint((*Runner))) {1009 counter++;1010 Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl;1011 return true;1012 }1013 }1014 return false;1015 };1016 1017 /** Combines second into the first and deletes the second.1018 * \param *P1 first polygon, contains all nodes on return1019 * \param *&P2 second polygon, is deleted.1020 */1021 void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2)1022 {1023 Info FunctionInfo(__func__);1024 pair <PointSet::iterator, bool> Tester;1025 for(PointSet::iterator Runner = P2->endpoints.begin(); Runner != P2->endpoints.end(); Runner++) {1026 Tester = P1->endpoints.insert((*Runner));1027 if (Tester.second)1028 Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl;1029 }1030 P2->endpoints.clear();1031 delete(P2);1032 };1033 -
src/tesselationhelpers.hpp
r0b2dd2 r482373 72 72 bool CheckListOfBaselines(const Tesselation * const TesselStruct); 73 73 74 int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T);75 bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2);76 void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2);77 78 74 79 75 #endif /* TESSELATIONHELPERS_HPP_ */ -
src/unittests/Makefile.am
r0b2dd2 r482373 4 4 AM_CXXFLAGS = $(CPPUNIT_CFLAGS) 5 5 6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTestListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest 7 7 check_PROGRAMS = $(TESTS) 8 8 noinst_PROGRAMS = $(TESTS) … … 25 25 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp 26 26 BondGraphUnitTest_LDADD = ../libmolecuilder.a 27 28 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp29 InfoUnitTest_LDADD = ../libmolecuilder.a30 27 31 28 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp -
src/vector.cpp
r0b2dd2 r482373 480 480 else 481 481 return false; 482 };483 484 /** Checks whether vector is normal to \a *normal.485 * @return true - vector is normalized, false - vector is not486 */487 bool Vector::IsEqualTo(const Vector * const a) const488 {489 bool status = true;490 for (int i=0;i<NDIM;i++) {491 if (fabs(x[i] - a->x[i]) > MYEPSILON)492 status = false;493 }494 return status;495 482 }; 496 483 -
src/vector.hpp
r0b2dd2 r482373 42 42 bool IsOne() const; 43 43 bool IsNormalTo(const Vector * const normal) const; 44 bool IsEqualTo(const Vector * const a) const;45 44 46 45 void AddVector(const Vector * const y); -
src/verbose.cpp
r0b2dd2 r482373 1 1 using namespace std; 2 2 3 #include "info.hpp"4 3 #include "verbose.hpp" 5 4 … … 10 9 ostream& Verbose::print (ostream &ost) const 11 10 { 12 for (int i=Verbosity +Info::verbosity;i--;)11 for (int i=Verbosity;i--;) 13 12 ost.put('\t'); 14 13 //Log() << Verbose(0) << "Verbose(.) called." << endl; … … 23 22 bool Verbose::DoOutput(int verbosityLevel) const 24 23 { 25 return (verbosityLevel >= Verbosity +Info::verbosity);24 return (verbosityLevel >= Verbosity); 26 25 }; 27 26 -
tests/Tesselations/1_2-dimethoxyethane/NonConvexEnvelope-1_2-dimethoxyethane.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 1_2-dimethoxyethane", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H10_ H15_ H16", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.6489 7.0567 6.6101 2 5 5 6.8975 7.0567 5.9709 2 -
tests/Tesselations/1_2-dimethylbenzene/NonConvexEnvelope-1_2-dimethylbenzene.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 1_2-dimethylbenzene", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- C07_ C08_ H09", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 8.3296 6.7712 6.0321 3 5 5 8.3296 8.1534 6.0305 3 -
tests/Tesselations/2-methylcyclohexanone/NonConvexEnvelope-2-methylcyclohexanone.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 2-methylcyclohexanone", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H15_ H18_ H19", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.2731 9.0957 6.144 1 5 5 10.8392 7.1885 6.8694 0 -
tests/Tesselations/C16_0-Torus/NonConvexEnvelope-C16_0-Torus.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" C16_0-Torus", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- C818_ C1839_ C1904", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 57.0669 28.4968 10.0318 2 5 5 53.7124 30.5841 10.0363 2 -
tests/Tesselations/Makefile.am
r0b2dd2 r482373 2 2 1_2-dimethylbenzene.test \ 3 3 2-methylcyclohexanone.test \ 4 benzene.test \5 4 cholesterol.test \ 6 5 cluster.test \ -
tests/Tesselations/N_N-dimethylacetamide/NonConvexEnvelope-N_N-dimethylacetamide.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" N_N-dimethylacetamide", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- C03_ O06_ H12", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 6.4232 7.1074 8.3151 3 5 5 6.5832 7.8674 9.2351 1 -
tests/Tesselations/cholesterol/NonConvexEnvelope-cholesterol.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" cholesterol", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H49_ H50_ H51", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 19.4519 9.7871 8.0824 1 5 5 12.9054 5.0485 9.284 1 -
tests/Tesselations/cluster/NonConvexEnvelope-cluster.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" cluster", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- O4864_ O4865_ O5836", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 59.3961 67.9193 74.1709 1 5 5 60.8097 66.4885 71.9891 1 -
tests/Tesselations/cycloheptane/NonConvexEnvelope-cycloheptane.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" cycloheptane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H08_ H12_ H13", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 5 8.6586 6.1486 0 5 5 5.8635 8.4046 7.6783 0 -
tests/Tesselations/dimethyl_bromomalonate/NonConvexEnvelope-dimethyl_bromomalonate.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" dimethyl_bromomalonate", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H12_ H13_ H14", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 8.1538 5 6.6665 1 5 5 6.8226 7.583 6.9158 4 -
tests/Tesselations/glucose/NonConvexEnvelope-glucose.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" glucose", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- C09_ O12_ H17", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.5866 5 7.577 1 5 5 8.4149 7.4116 8.4659 1 -
tests/Tesselations/heptan/NonConvexEnvelope-heptan.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" heptan", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H07_ H08_ H11", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.6377 5 6.78 0 5 5 9.6377 5 5 0 -
tests/Tesselations/isoleucine/NonConvexEnvelope-isoleucine.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" isoleucine", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H20_ H21_ H22", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.8909 7.216 6.6663 5 5 5 9.4763 5.271 6.3191 1 -
tests/Tesselations/neohexane/NonConvexEnvelope-neohexane.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" neohexane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H10_ H15_ H20", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 7.1525 6.2503 8.0589 1 5 5 7.1525 8.0303 8.0578 1 -
tests/Tesselations/proline/NonConvexEnvelope-proline.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" proline", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- H10_ H13_ H17", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.2095 7.1856 6.6953 4 5 5 9.3187 7.948 7.6262 2 -
tests/Tesselations/putrescine/NonConvexEnvelope-putrescine.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" putrescine", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- N06_ H17_ H18", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.8857 5.9511 6.2964 1 5 5 5.5257 8.9311 6.4164 1 -
tests/Tesselations/round_cluster/NonConvexEnvelope-round_cluster.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" round_cluster", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- O633_ O960_ O1013", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 41.4883 31.1464 29.9646 2 5 5 35.0153 37.6127 31.0313 4 -
tests/Tesselations/tartaric_acid/NonConvexEnvelope-tartaric_acid.dat
r0b2dd2 r482373 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" tartaric_acid", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="0- C05_ O09_ H12", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.156 6.9295 6.2926 4 5 5 8.5078 5.7627 5 1
Note:
See TracChangeset
for help on using the changeset viewer.