Changeset 7dea7c
- Timestamp:
- Oct 2, 2009, 3:19:51 PM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- a33931, aba92d
- Parents:
- e4a379
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
re4a379 r7dea7c 572 572 573 573 // third step: IsConvexRectangle 574 LineRunner = TesselStruct->LinesOnBoundary.begin();575 LineAdvance = LineRunner; // we need an advanced line, as the LineRunner might get removed576 while (LineRunner != TesselStruct->LinesOnBoundary.end()) {577 LineAdvance++;578 line = LineRunner->second;579 *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;580 //if (LineAdvance != TesselStruct->LinesOnBoundary.end())581 //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;582 if (!line->CheckConvexityCriterion(out)) {583 *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;584 585 // take highest of both lines586 point = TesselStruct->IsConvexRectangle(out, line);587 if (point != NULL)588 volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);589 }590 LineRunner = LineAdvance;591 }574 // LineRunner = TesselStruct->LinesOnBoundary.begin(); 575 // LineAdvance = LineRunner; // we need an advanced line, as the LineRunner might get removed 576 // while (LineRunner != TesselStruct->LinesOnBoundary.end()) { 577 // LineAdvance++; 578 // line = LineRunner->second; 579 // *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl; 580 // //if (LineAdvance != TesselStruct->LinesOnBoundary.end()) 581 // //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl; 582 // if (!line->CheckConvexityCriterion(out)) { 583 // *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl; 584 // 585 // // take highest of both lines 586 // point = TesselStruct->IsConvexRectangle(out, line); 587 // if (point != NULL) 588 // volume += TesselStruct->RemovePointFromTesselatedSurface(out, point); 589 // } 590 // LineRunner = LineAdvance; 591 // } 592 592 593 593 CalculateConcavityPerBoundaryPoint(out, TesselStruct); … … 600 600 }; 601 601 602 /** Calculates the concavity for each of the BoundaryPointSet's in a Tesselation.603 * Sets BoundaryPointSet::value equal to the number of connected lines that are not convex.604 * \param *out output stream for debugging605 * \param *TesselStruct pointer to Tesselation structure606 */607 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct)608 {609 class BoundaryPointSet *point = NULL;610 class BoundaryLineSet *line = NULL;611 // calculate remaining concavity612 for (PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {613 point = PointRunner->second;614 *out << Verbose(1) << "INFO: Current point is " << *point << "." << endl;615 point->value = 0;616 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {617 line = LineRunner->second;618 *out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;619 if (!line->CheckConvexityCriterion(out))620 point->value += 1;621 }622 }623 };624 625 /** Stores triangles to file.626 * \param *out output stream for debugging627 * \param *mol molecule with atoms and bonds628 * \param *filename prefix of filename629 * \param *extraSuffix intermediate suffix630 */631 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)632 {633 // 4. Store triangles in tecplot file634 if (filename != NULL) {635 if (DoTecplotOutput) {636 string OutputName(filename);637 OutputName.append(extraSuffix);638 OutputName.append(TecplotSuffix);639 ofstream *tecplot = new ofstream(OutputName.c_str());640 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);641 tecplot->close();642 delete(tecplot);643 }644 if (DoRaster3DOutput) {645 string OutputName(filename);646 OutputName.append(extraSuffix);647 OutputName.append(Raster3DSuffix);648 ofstream *rasterplot = new ofstream(OutputName.c_str());649 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);650 rasterplot->close();651 delete(rasterplot);652 }653 }654 };655 602 656 603 /** Determines the volume of a cluster. … … 699 646 700 647 return volume; 701 } 702 ; 648 }; 649 650 /** Stores triangles to file. 651 * \param *out output stream for debugging 652 * \param *mol molecule with atoms and bonds 653 * \param *filename prefix of filename 654 * \param *extraSuffix intermediate suffix 655 */ 656 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix) 657 { 658 // 4. Store triangles in tecplot file 659 if (filename != NULL) { 660 if (DoTecplotOutput) { 661 string OutputName(filename); 662 OutputName.append(extraSuffix); 663 OutputName.append(TecplotSuffix); 664 ofstream *tecplot = new ofstream(OutputName.c_str()); 665 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0); 666 tecplot->close(); 667 delete(tecplot); 668 } 669 if (DoRaster3DOutput) { 670 string OutputName(filename); 671 OutputName.append(extraSuffix); 672 OutputName.append(Raster3DSuffix); 673 ofstream *rasterplot = new ofstream(OutputName.c_str()); 674 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol); 675 rasterplot->close(); 676 delete(rasterplot); 677 } 678 } 679 }; 703 680 704 681 /** Creates multiples of the by \a *mol given cluster and suspends them in water with a given final density. … … 990 967 void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL) 991 968 { 992 int N = 0;993 969 bool freeLC = false; 994 970 … … 1005 981 LineMap::iterator testline; 1006 982 *out << Verbose(0) << "Begin of FindNonConvexBorder\n"; 1007 bool flag = false; // marks whether we went once through all baselines without finding any without two triangles1008 bool failflag = false;983 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles 984 bool TesselationFailFlag = false; 1009 985 1010 986 // initialise Linked Cell … … 1020 996 baseline = mol->TesselStruct->LinesOnBoundary.begin(); 1021 997 baseline++; // skip first line 1022 while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || ( flag)) {998 while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 1023 999 if (baseline->second->triangles.size() == 1) { 1024 1000 // 3. find next triangle 1025 failflag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.1026 flag = flag || failflag;1027 if (! failflag)1001 TesselationFailFlag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1002 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 1003 if (!TesselationFailFlag) 1028 1004 cerr << "WARNING: FindNextSuitableTriangle failed." << endl; 1029 1005 1030 1006 // write temporary envelope 1031 1007 if (filename != NULL) { 1032 if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0) || (mol->TesselStruct->TrianglesOnBoundary.size() > 8520 && mol->TesselStruct->TrianglesOnBoundary.size() <= 8530)))) { // if we have a new triangle and want to output each new triangle configuration1008 if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1033 1009 mol->TesselStruct->Output(out, filename, mol); 1034 1010 } 1035 1011 } 1036 1012 baseline = mol->TesselStruct->LinesOnBoundary.end(); 1013 *out << Verbose(2) << "Baseline set to end." << endl; 1037 1014 } else { 1038 1015 //cout << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; … … 1041 1018 } 1042 1019 1043 N++; 1044 if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (flag)) { 1020 if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1045 1021 baseline = mol->TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 1046 baseline++; 1047 flag = false; 1048 } 1049 } 1022 OneLoopWithoutSuccessFlag = false; 1023 } 1024 baseline++; 1025 } 1026 // check envelope for consistency 1027 CheckListOfBaselines(out, mol->TesselStruct); 1028 1050 1029 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1051 1030 mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList); … … 1067 1046 mol->TesselStruct->RemoveDegeneratedTriangles(); 1068 1047 1069 cout << Verbose(2) << "Check: List of Baselines with not two connected triangles:" << endl; 1070 int counter = 0; 1071 for (testline = mol->TesselStruct->LinesOnBoundary.begin(); testline != mol->TesselStruct->LinesOnBoundary.end(); testline++) { 1072 if (testline->second->triangles.size() != 2) { 1073 cout << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl; 1074 counter++; 1075 } 1076 } 1077 if (counter == 0) 1078 *out << Verbose(2) << "None." << endl; 1048 // check envelope for consistency 1049 CheckListOfBaselines(out, mol->TesselStruct); 1079 1050 1080 1051 // write final envelope -
src/boundary.hpp
re4a379 r7dea7c 36 36 void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC); 37 37 Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol); 38 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct);39 38 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix); 40 39 bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation *TesselStruct, molecule *mol, char *filename); -
src/tesselation.cpp
re4a379 r7dea7c 215 215 node = runner->second->GetThirdEndpoint(this); 216 216 if (node != NULL) { 217 *out << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;217 //*out << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl; 218 218 helper[i].CopyVector(node->node->node); 219 219 helper[i].SubtractVector(&BaseLineCenter); 220 220 helper[i].MakeNormalVector(&BaseLine); // we want to compare the triangle's heights' angles! 221 *out << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;221 //*out << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl; 222 222 i++; 223 223 } else { … … 226 226 } 227 227 } 228 *out << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;228 //*out << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl; 229 229 if (NormalCheck.NormSquared() < MYEPSILON) { 230 230 *out << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl; … … 374 374 * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane 375 375 * This we test if it's really on the plane and whether it's inside the triangle on the plane or not. 376 * The latter is done as follows: if it's really outside, then for any endpoint of the triangle and it's opposite377 * base line, the intersection between the line from endpoint to intersection and the base line will have a Vector::NormSquared()378 * smaller than the first line.376 * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line 377 * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between 378 * the first two basepoints) or not. 379 379 * \param *out output stream for debugging 380 380 * \param *MolCenter offset vector of line … … 408 408 exit(255); 409 409 } 410 CrossPoint.SubtractVector(endpoints[i%3]->node->node); 410 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector 411 411 412 412 // check whether intersection is inside or not by comparing length of intersection and length of cross point 413 if ((CrossPoint.NormSquared() - helper.NormSquared()) > -MYEPSILON) { // inside413 if ((CrossPoint.NormSquared() - helper.NormSquared()) < MYEPSILON) { // inside 414 414 return true; 415 415 } else { // outside! … … 439 439 for(int i=0;i<3;i++) 440 440 if (point == endpoints[i]) 441 return true; 442 return false; 443 }; 444 445 /** Checks whether point is any of the three endpoints this triangle contains. 446 * \param *point TesselPoint to test 447 * \return true - point is of the triangle, false - is not 448 */ 449 bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point) 450 { 451 for(int i=0;i<3;i++) 452 if (point == endpoints[i]->node) 441 453 return true; 442 454 return false; … … 1088 1100 Vector *Center = cloud->GetCenter(out); 1089 1101 list<BoundaryTriangleSet*> *triangles = NULL; 1102 bool AddFlag = false; 1103 LinkedCell *BoundaryPoints = NULL; 1090 1104 1091 1105 *out << Verbose(1) << "Begin of InsertStraddlingPoints" << endl; 1092 1106 1093 1107 cloud->GoToFirst(); 1108 BoundaryPoints = new LinkedCell(this, 5.); 1094 1109 while (!cloud->IsEnd()) { // we only have to go once through all points, as boundary can become only bigger 1095 LinkedCell BoundaryPoints(this, 5.); 1110 if (AddFlag) { 1111 delete(BoundaryPoints); 1112 BoundaryPoints = new LinkedCell(this, 5.); 1113 AddFlag = false; 1114 } 1096 1115 Walker = cloud->GetPoint(); 1097 1116 *out << Verbose(2) << "Current point is " << *Walker << "." << endl; 1098 1117 // get the next triangle 1099 triangles = FindClosestTrianglesToPoint(out, Walker->node, &BoundaryPoints); 1100 if (triangles == NULL) { 1101 *out << Verbose(1) << "No triangles found, probably a tesselation point itself." << endl; 1118 triangles = FindClosestTrianglesToPoint(out, Walker->node, BoundaryPoints); 1119 BTS = triangles->front(); 1120 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1121 *out << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl; 1102 1122 cloud->GoToNext(); 1103 1123 continue; 1104 1124 } else { 1105 BTS = triangles->front();1106 1125 } 1107 1126 *out << Verbose(2) << "Closest triangle is " << *BTS << "." << endl; … … 1126 1145 // add Walker to boundary points 1127 1146 *out << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl; 1147 AddFlag = true; 1128 1148 if (AddBoundaryPoint(Walker,0)) 1129 1149 NewPoint = BPS[0]; … … 1279 1299 }; 1280 1300 1281 /** Function tries to add Triangle just created to Triangle and remarks if already existent (Failure of algorithm).1282 * Furthermore it adds the triangle to all of its lines, in order to recognize those which are saturated later.1301 /** Function adds triangle to global list. 1302 * Furthermore, the triangle receives the next free id and id counter \a TrianglesOnBoundaryCount is increased. 1283 1303 */ 1284 1304 void Tesselation::AddTesselationTriangle() … … 1289 1309 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1290 1310 TrianglesOnBoundaryCount++; 1311 1312 // set as last new triangle 1313 LastTriangle = BTS; 1314 1315 // NOTE: add triangle to local maps is done in constructor of BoundaryTriangleSet 1316 }; 1317 1318 /** Function adds triangle to global list. 1319 * Furthermore, the triangle number is set to \a nr. 1320 * \param nr triangle number 1321 */ 1322 void Tesselation::AddTesselationTriangle(int nr) 1323 { 1324 cout << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1325 1326 // add triangle to global map 1327 TrianglesOnBoundary.insert(TrianglePair(nr, BTS)); 1291 1328 1292 1329 // set as last new triangle … … 2097 2134 BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[0]); 2098 2135 BTS->GetNormalVector(BaseLineNormal); 2099 TrianglesOnBoundary.insert(TrianglePair(OldTriangleNrs[0], BTS));2136 AddTesselationTriangle(OldTriangleNrs[0]); 2100 2137 *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl; 2101 2138 … … 2105 2142 BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[1]); 2106 2143 BTS->GetNormalVector(BaseLineNormal); 2107 TrianglesOnBoundary.insert(TrianglePair(OldTriangleNrs[1], BTS));2144 AddTesselationTriangle(OldTriangleNrs[1]); 2108 2145 *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl; 2109 2146 } else { … … 2481 2518 } 2482 2519 if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) { 2483 *out << Verbose( 2) << "Point is right on a tesselation point, no nearest triangle." << endl;2520 *out << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl; 2484 2521 PointMap::iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr); 2485 2522 triangles = new list<BoundaryTriangleSet*>; … … 2512 2549 *out << Verbose(1) << "ERROR: IsInnerPoint encounters serious error, point " << i << " not found." << endl; 2513 2550 } 2514 *out << Verbose(1) << "List of triangle points:" << endl;2515 *out << Verbose(2) << *trianglePoints[i] << endl;2551 //*out << Verbose(2) << "List of triangle points:" << endl; 2552 //*out << Verbose(3) << *trianglePoints[i] << endl; 2516 2553 } 2517 2554 2518 2555 triangles = FindTriangles(trianglePoints); 2519 *out << Verbose( 1) << "List of possible triangles:" << endl;2556 *out << Verbose(2) << "List of possible triangles:" << endl; 2520 2557 for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) 2521 *out << Verbose( 2) << **Runner << endl;2558 *out << Verbose(3) << **Runner << endl; 2522 2559 2523 2560 delete(connectedClosestPoints); … … 3299 3336 int count = 0; 3300 3337 3338 cout << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl; 3339 3301 3340 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); 3302 3341 TriangleKeyRunner != DegeneratedTriangles->end(); ++TriangleKeyRunner … … 3370 3409 3371 3410 cout << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3411 cout << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl; 3372 3412 } 3373 3413 -
src/tesselation.hpp
re4a379 r7dea7c 126 126 bool ContainsBoundaryLine(class BoundaryLineSet *line); 127 127 bool ContainsBoundaryPoint(class BoundaryPointSet *point); 128 bool ContainsBoundaryPoint(class TesselPoint *point); 128 129 class BoundaryPointSet *GetThirdEndpoint(class BoundaryLineSet *line); 129 130 bool IsPresentTupel(class BoundaryPointSet *Points[3]); … … 204 205 void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n); 205 206 void AddTesselationTriangle(); 207 void AddTesselationTriangle(int nr); 206 208 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle); 207 209 void RemoveTesselationLine(class BoundaryLineSet *line); -
src/tesselationhelpers.cpp
re4a379 r7dea7c 598 598 for(int i=0;i<NDIM;i++) // store indices of this cell 599 599 N[i] = LC->n[i]; 600 cout << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;600 cout << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 601 601 602 602 LC->GetNeighbourBounds(Nlower, Nupper); … … 828 828 } 829 829 }; 830 831 /** Calculates the concavity for each of the BoundaryPointSet's in a Tesselation. 832 * Sets BoundaryPointSet::value equal to the number of connected lines that are not convex. 833 * \param *out output stream for debugging 834 * \param *TesselStruct pointer to Tesselation structure 835 */ 836 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct) 837 { 838 class BoundaryPointSet *point = NULL; 839 class BoundaryLineSet *line = NULL; 840 841 //*out << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl; 842 // calculate remaining concavity 843 for (PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { 844 point = PointRunner->second; 845 *out << Verbose(1) << "INFO: Current point is " << *point << "." << endl; 846 point->value = 0; 847 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 848 line = LineRunner->second; 849 //*out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 850 if (!line->CheckConvexityCriterion(out)) 851 point->value += 1; 852 } 853 } 854 //*out << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl; 855 }; 856 857 858 /** Checks whether each BoundaryLineSet in the Tesselation has two triangles. 859 * \param *out output stream for debugging 860 * \param *TesselStruct 861 * \return true - all have exactly two triangles, false - some not, list is printed to screen 862 */ 863 bool CheckListOfBaselines(ofstream *out, Tesselation *TesselStruct) 864 { 865 LineMap::iterator testline; 866 bool result = false; 867 int counter = 0; 868 869 *out << Verbose(1) << "Check: List of Baselines with not two connected triangles:" << endl; 870 for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) { 871 if (testline->second->triangles.size() != 2) { 872 *out << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl; 873 counter++; 874 } 875 } 876 if (counter == 0) { 877 *out << Verbose(1) << "None." << endl; 878 result = true; 879 } 880 return result; 881 } 882 -
src/tesselationhelpers.hpp
re4a379 r7dea7c 50 50 void IncludeSphereinRaster3D(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, PointCloud *cloud); 51 51 void WriteVrmlFile(ofstream *out, ofstream *vrmlfile, class Tesselation *Tess, PointCloud *cloud); 52 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct); 53 54 bool CheckListOfBaselines(ofstream *out, Tesselation *TesselStruct); 52 55 53 56
Note:
See TracChangeset
for help on using the changeset viewer.