- Timestamp:
- Nov 25, 2009, 12:18:18 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 8725ed
- Parents:
- 791138
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r791138 r1e168b 955 955 { 956 956 bool freeLC = false; 957 LineMap::iteratorbaseline;957 CandidateForTesselation *baseline; 958 958 LineMap::iterator testline; 959 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles959 bool OneLoopWithoutSuccessFlag = true; // marks whether we went once through all baselines without finding any without two triangles 960 960 bool TesselationFailFlag = false; 961 961 … … 982 982 983 983 // 2. expand from there 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 } 984 while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) { 985 // 2a. fill all new OpenLines 986 Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl; 987 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 988 Log() << Verbose(1) << *(Runner->second) << endl; 989 990 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 991 baseline = Runner->second; 992 if (baseline->point == NULL) { 993 Log() << Verbose(0) << "Finding best candidate for open line " << *baseline->BaseLine << endl; 994 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *(((baseline->BaseLine->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1000 995 } 1001 if (TesselationFailFlag) { 1002 baseline = TesselStruct->LinesOnBoundary.begin(); 1003 OneLoopWithoutSuccessFlag = false; 1004 Log() << Verbose(2) << "Baseline set to begin." << endl; 996 } 997 998 // 2b. search for smallest ShortestAngle among all candidates 999 double ShortestAngle = 4.*M_PI; 1000 Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl; 1001 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 1002 Log() << Verbose(1) << *(Runner->second) << endl; 1003 1004 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 1005 if (Runner->second->ShortestAngle < ShortestAngle) { 1006 baseline = Runner->second; 1007 ShortestAngle = baseline->ShortestAngle; 1008 //Log() << Verbose(0) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl; 1005 1009 } 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(); 1010 } 1011 if ((ShortestAngle == 4.*M_PI) || (baseline->point == NULL)) 1012 OneLoopWithoutSuccessFlag = false; 1013 else { 1014 TesselStruct->AddCandidateTriangle(*baseline); 1015 } 1016 1017 // write temporary envelope 1018 if (filename != NULL) { 1019 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1020 TesselStruct->Output(filename, mol); 1011 1021 } 1012 1022 } 1013 1014 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {1015 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines1016 OneLoopWithoutSuccessFlag = false;1017 }1018 baseline++;1019 1023 } 1020 1024 // check envelope for consistency -
src/tesselation.cpp
r791138 r1e168b 22 22 /** Constructor of BoundaryPointSet. 23 23 */ 24 BoundaryPointSet::BoundaryPointSet() 25 { 26 LinesCount = 0;27 Nr = -1;28 value = 0.; 24 BoundaryPointSet::BoundaryPointSet() : 25 LinesCount(0), 26 value(0.), 27 Nr(-1) 28 { 29 29 }; 30 30 … … 85 85 /** Constructor of BoundaryLineSet. 86 86 */ 87 BoundaryLineSet::BoundaryLineSet() 87 BoundaryLineSet::BoundaryLineSet() : 88 Nr(-1) 88 89 { 89 90 for (int i = 0; i < 2; i++) 90 91 endpoints[i] = NULL; 91 Nr = -1;92 92 }; 93 93 … … 106 106 Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding. 107 107 Point[1]->AddLine(this); // 108 // set skipped to false 109 skipped = false; 108 110 // clear triangles list 109 111 Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl; … … 286 288 /** Constructor for BoundaryTriangleSet. 287 289 */ 288 BoundaryTriangleSet::BoundaryTriangleSet() 290 BoundaryTriangleSet::BoundaryTriangleSet() : 291 Nr(-1) 289 292 { 290 293 for (int i = 0; i < 3; i++) … … 293 296 lines[i] = NULL; 294 297 } 295 Nr = -1;296 298 }; 297 299 … … 300 302 * \param number number of triangle 301 303 */ 302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) 304 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) : 305 Nr(number) 303 306 { 304 307 // set number 305 Nr = number;306 308 // set lines 307 Log() << Verbose(5) << "New triangle " << Nr << ":" << endl;309 Log() << Verbose(5) << "New triangle " << Nr << ":"; 308 310 for (int i = 0; i < 3; i++) 309 311 { … … 579 581 PointCloud::PointCloud() 580 582 { 581 582 583 }; 583 584 … … 586 587 PointCloud::~PointCloud() 587 588 { 588 589 589 }; 590 590 … … 593 593 /** Constructor of class CandidateForTesselation. 594 594 */ 595 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) { 596 point = candidate; 597 BaseLine = line; 595 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 596 point(NULL), 597 BaseLine(line), 598 ShortestAngle(2.*M_PI), 599 OtherShortestAngle(2.*M_PI) 600 { 601 }; 602 603 604 /** Constructor of class CandidateForTesselation. 605 */ 606 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 607 point(candidate), 608 BaseLine(line), 609 ShortestAngle(2.*M_PI), 610 OtherShortestAngle(2.*M_PI) 611 { 598 612 OptCenter.CopyVector(&OptCandidateCenter); 599 613 OtherOptCenter.CopyVector(&OtherOptCandidateCenter); … … 607 621 }; 608 622 623 /** output operator for CandidateForTesselation. 624 * \param &ost output stream 625 * \param &a boundary line 626 */ 627 ostream & operator <<(ostream &ost, const CandidateForTesselation &a) 628 { 629 ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with "; 630 if (a.point == NULL) 631 ost << "no candidate."; 632 else 633 ost << "candidate " << *(a.point) << " at angle " << (a.ShortestAngle)<< "."; 634 635 return ost; 636 }; 637 638 609 639 // =========================================================== class TESSELATION =========================================== 610 640 611 641 /** Constructor of class Tesselation. 612 642 */ 613 Tesselation::Tesselation() 614 { 615 PointsOnBoundaryCount = 0;616 LinesOnBoundaryCount = 0;617 TrianglesOnBoundaryCount = 0;618 InternalPointer = PointsOnBoundary.begin();619 LastTriangle = NULL;620 TriangleFilesWritten = 0; 643 Tesselation::Tesselation() : 644 PointsOnBoundaryCount(0), 645 LinesOnBoundaryCount(0), 646 TrianglesOnBoundaryCount(0), 647 LastTriangle(NULL), 648 TriangleFilesWritten(0), 649 InternalPointer(PointsOnBoundary.begin()) 650 { 621 651 } 622 652 ; … … 1283 1313 BLS[n] = FindLine->second; 1284 1314 1315 // remove existing line from OpenLines 1316 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 1317 delete(CandidateLine->second); 1318 OpenLines.erase(CandidateLine); 1319 1285 1320 break; 1286 1321 } … … 1304 1339 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n) 1305 1340 { 1306 Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;1341 Log() << Verbose(4) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1307 1342 BPS[0] = a; 1308 1343 BPS[1] = b; … … 1312 1347 // increase counter 1313 1348 LinesOnBoundaryCount++; 1349 // also add to open lines 1350 CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]); 1351 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT)); 1314 1352 }; 1315 1353 … … 1680 1718 << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n"; 1681 1719 1682 // if we do not reach the end with the next step of iteration, we need to setup a new first line1683 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 them1687 AddTesselationPoint(FirstPoint, 0);1688 AddTesselationPoint(SecondPoint, 1);1689 AddTesselationLine(TPS[0], TPS[1], 0);1690 }1720 // // if we do not reach the end with the next step of iteration, we need to setup a new first line 1721 // if (it != OptCandidates->end()--) { 1722 // FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1723 // SecondPoint = (*it)->point; 1724 // // adding point 1 and point 2 and the line between them 1725 // AddTesselationPoint(FirstPoint, 0); 1726 // AddTesselationPoint(SecondPoint, 1); 1727 // AddTesselationLine(TPS[0], TPS[1], 0); 1728 // } 1691 1729 Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl; 1692 1730 } … … 1860 1898 /** This function finds a triangle to a line, adjacent to an existing one. 1861 1899 * @param out output stream for debugging 1862 * @param Line currentbaseline to search from1900 * @param CandidateLine current cadndiate baseline to search from 1863 1901 * @param T current triangle which \a Line is edge of 1864 1902 * @param RADIUS radius of the rolling ball … … 1866 1904 * @param *LC LinkedCell structure with neighbouring points 1867 1905 */ 1868 bool Tesselation::FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)1906 bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC) 1869 1907 { 1870 1908 Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n"; … … 1882 1920 double radius, CircleRadius; 1883 1921 1884 Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;1922 Log() << Verbose(1) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl; 1885 1923 for (int i=0;i<3;i++) 1886 if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))1924 if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) 1887 1925 ThirdNode = T.endpoints[i]->node; 1888 1926 1889 1927 // construct center of circle 1890 CircleCenter.CopyVector( Line.endpoints[0]->node->node);1891 CircleCenter.AddVector( Line.endpoints[1]->node->node);1928 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1929 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1892 1930 CircleCenter.Scale(0.5); 1893 1931 1894 1932 // construct normal vector of circle 1895 CirclePlaneNormal.CopyVector( Line.endpoints[0]->node->node);1896 CirclePlaneNormal.SubtractVector( Line.endpoints[1]->node->node);1933 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1934 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1897 1935 1898 1936 // calculate squared radius of circle … … 1906 1944 GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node); 1907 1945 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);1946 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1909 1947 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1910 1948 OldSphereCenter.AddVector(&helper); … … 1914 1952 // construct SearchDirection 1915 1953 SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal); 1916 helper.CopyVector( Line.endpoints[0]->node->node);1954 helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1917 1955 helper.SubtractVector(ThirdNode->node); 1918 1956 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! … … 1927 1965 1928 1966 // add third point 1929 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);1967 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine.BaseLine, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC); 1930 1968 1931 1969 } else { 1932 Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;1970 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl; 1933 1971 } 1934 1972 … … 1942 1980 } 1943 1981 1944 BoundaryLineSet *BaseRay = &Line;1982 BoundaryLineSet *BaseRay = CandidateLine.BaseLine; 1945 1983 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1946 1984 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point … … 1969 2007 1970 2008 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1971 AddTesselationLine(TPS[0], TPS[1], 0); 1972 AddTesselationLine(TPS[0], TPS[2], 1); 1973 AddTesselationLine(TPS[1], TPS[2], 2); 1974 1975 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1976 AddTesselationTriangle(); 1977 (*it)->OptCenter.Scale(-1.); 1978 BTS->GetNormalVector((*it)->OptCenter); 1979 (*it)->OptCenter.Scale(-1.); 1980 1981 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1982 << " for this triangle ... " << endl; 1983 //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl; 2009 CandidateLine.point = (*it)->point; 2010 CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter)); 2011 CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter)); 2012 CandidateLine.ShortestAngle = ShortestAngle; 1984 2013 } else { 1985 eLog() << Verbose(2) << "This triangle consisting of ";1986 Log() << Verbose(0) << *(*it)->point << ", ";1987 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";1988 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";1989 Log() << Verbose(0) << "exists and is not added, as itdoes not seem helpful!" << endl;2014 // eLog() << Verbose(2) << "This triangle consisting of "; 2015 // Log() << Verbose(0) << *(*it)->point << ", "; 2016 // Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2017 // Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2018 // Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl; 1990 2019 result = false; 1991 2020 } … … 1997 2026 // 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) 1998 2027 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1999 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 2000 AddTesselationLine(TPS[0], TPS[1], 0); 2001 AddTesselationLine(TPS[0], TPS[2], 1); 2002 AddTesselationLine(TPS[1], TPS[2], 2); 2003 2004 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2005 AddTesselationTriangle(); // add to global map 2006 2007 (*it)->OtherOptCenter.Scale(-1.); 2008 BTS->GetNormalVector((*it)->OtherOptCenter); 2009 (*it)->OtherOptCenter.Scale(-1.); 2010 2011 eLog() << Verbose(2) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl; 2012 Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl; 2028 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) { 2029 CandidateLine.point = (*it)->point; 2030 CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter); 2031 CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter); 2032 CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI; 2033 2013 2034 } else { 2014 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;2035 // 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; 2015 2036 result = false; 2016 2037 } 2017 2038 } else { 2018 Log() << Verbose(1) << "This triangle consisting of ";2019 Log() << Verbose(0) << *(*it)->point << ", ";2020 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";2021 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";2022 Log() << Verbose(0) << "is invalid!" << endl;2039 // Log() << Verbose(1) << "This triangle consisting of "; 2040 // Log() << Verbose(0) << *(*it)->point << ", "; 2041 // Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2042 // Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2043 // Log() << Verbose(0) << "is invalid!" << endl; 2023 2044 result = false; 2024 2045 } … … 2043 2064 Log() << Verbose(0) << "End of FindNextSuitableTriangle\n"; 2044 2065 return result; 2066 }; 2067 2068 /** Adds the present line and candidate point from \a &CandidateLine to the Tesselation. 2069 * \param &CandidateLine triangle to add 2070 */ 2071 void Tesselation::AddCandidateTriangle(CandidateForTesselation &CandidateLine) 2072 { 2073 Vector Center; 2074 Log() << Verbose(2) << "BaseLine is :" << *(CandidateLine.BaseLine) << " with candidate " << *(CandidateLine.point) << "." << endl; 2075 // add the points 2076 AddTesselationPoint(CandidateLine.point, 0); 2077 AddTesselationPoint(CandidateLine.BaseLine->endpoints[0]->node, 1); 2078 AddTesselationPoint(CandidateLine.BaseLine->endpoints[1]->node, 2); 2079 2080 Center.CopyVector(&CandidateLine.OptCenter); 2081 // add the lines 2082 AddTesselationLine(TPS[0], TPS[1], 0); 2083 AddTesselationLine(TPS[0], TPS[2], 1); 2084 AddTesselationLine(TPS[1], TPS[2], 2); 2085 2086 // add the triangles 2087 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2088 AddTesselationTriangle(); 2089 Center.Scale(-1.); 2090 BTS->GetNormalVector(Center); 2091 2092 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl; 2045 2093 }; 2046 2094 -
src/tesselation.hpp
r791138 r1e168b 53 53 #define PointTestPair pair < PointMap::iterator, bool > 54 54 #define CandidateList list <class CandidateForTesselation *> 55 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *> 55 56 56 57 #define LineMap multimap < int, class BoundaryLineSet * > … … 114 115 TriangleMap triangles; 115 116 int Nr; 117 bool skipped; 116 118 }; 117 119 … … 186 188 class CandidateForTesselation { 187 189 public : 190 CandidateForTesselation(BoundaryLineSet* currentBaseLine); 188 191 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter); 189 192 ~CandidateForTesselation(); … … 193 196 Vector OptCenter; 194 197 Vector OtherOptCenter; 195 }; 198 double ShortestAngle; 199 double OtherShortestAngle; 200 }; 201 202 ostream & operator <<(ostream &ost, const CandidateForTesselation &a); 196 203 197 204 // =========================================================== class TESSELATION =========================================== … … 211 218 void AddTesselationTriangle(); 212 219 void AddTesselationTriangle(const int nr); 220 void AddCandidateTriangle(CandidateForTesselation &CandidateLine); 213 221 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle); 214 222 void RemoveTesselationLine(class BoundaryLineSet *line); … … 220 228 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC); 221 229 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; 222 bool FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);230 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC); 223 231 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const; 224 232 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]); … … 260 268 PointMap PointsOnBoundary; 261 269 LineMap LinesOnBoundary; 270 CandidateMap OpenLines; 262 271 TriangleMap TrianglesOnBoundary; 263 272 int PointsOnBoundaryCount;
Note:
See TracChangeset
for help on using the changeset viewer.