Changeset bdb143 for src/tesselation.cpp
- Timestamp:
- Jun 28, 2010, 3:38:05 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, Candidate_v1.7.0, 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:
- 13892b, 51a5c8
- Parents:
- b2531f (diff), c39cc4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (06/28/10 14:53:18)
- git-committer:
- Frederik Heber <heber@…> (06/28/10 15:38:05)
- File:
-
- 1 edited
-
src/tesselation.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
rb2531f rbdb143 231 231 { 232 232 Info FunctionInfo(__func__); 233 double angle = CalculateConvexity(); 234 if (angle > -MYEPSILON) { 235 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl); 236 return true; 237 } else { 238 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl); 239 return false; 240 } 241 } 242 243 244 /** Calculates the angle between two triangles with respect to their normal vector. 245 * We sum the two angles of each height vector with respect to the center of the baseline. 246 * \return angle > 0 then convex, if < 0 then concave 247 */ 248 double BoundaryLineSet::CalculateConvexity() const 249 { 250 Info FunctionInfo(__func__); 233 251 Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck; 234 252 // get the two triangles … … 279 297 BaseLineNormal.Scale(-1.); 280 298 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 281 if ((angle - M_PI) > -MYEPSILON) { 282 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl); 283 return true; 284 } else { 285 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl); 286 return false; 287 } 299 return (angle - M_PI); 288 300 } 289 301 … … 304 316 /** Returns other endpoint of the line. 305 317 * \param *point other endpoint 306 * \return NULL - if endpoint not contained in BoundaryLineSet , or pointer to BoundaryPointSet otherwise318 * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise 307 319 */ 308 320 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const … … 315 327 else 316 328 return NULL; 329 } 330 ; 331 332 /** Returns other triangle of the line. 333 * \param *point other endpoint 334 * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise 335 */ 336 class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const 337 { 338 Info FunctionInfo(__func__); 339 if (triangles.size() == 2) { 340 for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner) 341 if (TriangleRunner->second != triangle) 342 return TriangleRunner->second; 343 } 344 return NULL; 317 345 } 318 346 ; … … 661 689 ; 662 690 691 /** Returns the baseline which does not contain the given boundary point \a *point. 692 * \param *point endpoint which is neither endpoint of the desired line 693 * \return pointer to desired third baseline 694 */ 695 class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const 696 { 697 Info FunctionInfo(__func__); 698 // sanity check 699 if (!ContainsBoundaryPoint(point)) 700 return NULL; 701 for (int i = 0; i < 3; i++) 702 if (!lines[i]->ContainsBoundaryPoint(point)) 703 return lines[i]; 704 // actually, that' impossible :) 705 return NULL; 706 } 707 ; 708 663 709 /** Calculates the center point of the triangle. 664 710 * Is third of the sum of all endpoints. … … 1110 1156 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner)); 1111 1157 1112 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter<< ":" << endl);1158 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl); 1113 1159 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1114 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->distance( OtherOptCenter) << "." << endl);1160 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->distance(*(*VRunner)) << "." << endl); 1115 1161 1116 1162 // remove baseline's endpoints and candidates … … 1128 1174 DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl); 1129 1175 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1130 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << endl); 1176 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->node->distance(*(*VRunner)) << setprecision(6) << "." << endl); 1177 1178 // check with animate_sphere.tcl VMD script 1179 if (ThirdPoint != NULL) { 1180 DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl); 1181 } else { 1182 DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl); 1183 DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl); 1184 } 1131 1185 } 1132 1186 delete (ListofPoints); 1133 1187 1134 // check with animate_sphere.tcl VMD script1135 if (ThirdPoint != NULL) {1136 DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);1137 } else {1138 DoLog(1) && (Log() << Verbose(1) << "Check by: ... missing third point ..." << endl);1139 DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);1140 }1141 1188 } 1142 1189 return flag; … … 3290 3337 } 3291 3338 } else { 3292 Do Log(1) && (Log() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl);3339 DoeLog(0) && (eLog() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl); 3293 3340 } 3294 3341 } else { … … 4590 4637 4591 4638 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl); 4592 IndexToIndex::iterator it; 4593 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 4639 for (IndexToIndex::iterator it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 4594 4640 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl); 4595 4641 … … 4609 4655 int count = 0; 4610 4656 4611 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); TriangleKeyRunner != DegeneratedTriangles->end(); ++TriangleKeyRunner) { 4657 // iterate over all degenerated triangles 4658 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); !DegeneratedTriangles->empty(); TriangleKeyRunner = DegeneratedTriangles->begin()) { 4659 DoLog(0) && (Log() << Verbose(0) << "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "." << endl); 4660 // both ways are stored in the map, only use one 4661 if (TriangleKeyRunner->first > TriangleKeyRunner->second) 4662 continue; 4663 4664 // determine from the keys in the map the two _present_ triangles 4612 4665 finder = TrianglesOnBoundary.find(TriangleKeyRunner->first); 4613 4666 if (finder != TrianglesOnBoundary.end()) 4614 4667 triangle = finder->second; 4615 4668 else 4616 break;4669 continue; 4617 4670 finder = TrianglesOnBoundary.find(TriangleKeyRunner->second); 4618 4671 if (finder != TrianglesOnBoundary.end()) 4619 4672 partnerTriangle = finder->second; 4620 4673 else 4621 break; 4622 4674 continue; 4675 4676 // determine which lines are shared by the two triangles 4623 4677 bool trianglesShareLine = false; 4624 4678 for (int i = 0; i < 3; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.
