Changeset b32dbb for src/tesselation.cpp
- Timestamp:
- May 29, 2010, 12:59:31 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, 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:
- a7c344
- Parents:
- bfd839
- git-author:
- Frederik Heber <heber@…> (05/27/10 11:04:42)
- git-committer:
- Frederik Heber <heber@…> (05/29/10 12:59:31)
- File:
-
- 1 edited
-
src/tesselation.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
rbfd839 rb32dbb 229 229 { 230 230 Info FunctionInfo(__func__); 231 double angle = CalculateConvexity(); 232 if (angle > -MYEPSILON) { 233 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl); 234 return true; 235 } else { 236 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl); 237 return false; 238 } 239 } 240 241 242 /** Calculates the angle between two triangles with respect to their normal vector. 243 * We sum the two angles of each height vector with respect to the center of the baseline. 244 * \return angle > 0 then convex, if < 0 then concave 245 */ 246 double BoundaryLineSet::CalculateConvexity() const 247 { 248 Info FunctionInfo(__func__); 231 249 Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck; 232 250 // get the two triangles … … 277 295 BaseLineNormal.Scale(-1.); 278 296 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 279 if ((angle - M_PI) > -MYEPSILON) { 280 DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl); 281 return true; 282 } else { 283 DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl); 284 return false; 285 } 297 return (angle - M_PI); 286 298 } 287 299 … … 302 314 /** Returns other endpoint of the line. 303 315 * \param *point other endpoint 304 * \return NULL - if endpoint not contained in BoundaryLineSet , or pointer to BoundaryPointSet otherwise316 * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise 305 317 */ 306 318 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const … … 313 325 else 314 326 return NULL; 327 } 328 ; 329 330 /** Returns other triangle of the line. 331 * \param *point other endpoint 332 * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise 333 */ 334 class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const 335 { 336 Info FunctionInfo(__func__); 337 if (triangles.size() == 2) { 338 for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner) 339 if (TriangleRunner->second != triangle) 340 return TriangleRunner->second; 341 } 342 return NULL; 315 343 } 316 344 ; … … 669 697 ; 670 698 699 /** Returns the baseline which does not contain the given boundary point \a *point. 700 * \param *point endpoint which is neither endpoint of the desired line 701 * \return pointer to desired third baseline 702 */ 703 class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const 704 { 705 Info FunctionInfo(__func__); 706 // sanity check 707 if (!ContainsBoundaryPoint(point)) 708 return NULL; 709 for (int i = 0; i < 3; i++) 710 if (!lines[i]->ContainsBoundaryPoint(point)) 711 return lines[i]; 712 // actually, that' impossible :) 713 return NULL; 714 } 715 ; 716 671 717 /** Calculates the center point of the triangle. 672 718 * Is third of the sum of all endpoints. … … 1106 1152 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner)); 1107 1153 1108 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter<< ":" << endl);1154 DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl); 1109 1155 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1110 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->distance( OtherOptCenter) << "." << endl);1156 DoLog(1) && (Log() << Verbose(1) << " " << *(*Runner) << " with distance " << (*Runner)->node->distance(*(*VRunner)) << "." << endl); 1111 1157 1112 1158 // remove baseline's endpoints and candidates … … 1124 1170 DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl); 1125 1171 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1126 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << endl); 1172 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->node->distance(*(*VRunner)) << setprecision(6) << "." << endl); 1173 1174 // check with animate_sphere.tcl VMD script 1175 if (ThirdPoint != NULL) { 1176 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); 1177 } else { 1178 DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl); 1179 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); 1180 } 1127 1181 } 1128 1182 delete (ListofPoints); 1129 1183 1130 // check with animate_sphere.tcl VMD script1131 if (ThirdPoint != NULL) {1132 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);1133 } else {1134 DoLog(1) && (Log() << Verbose(1) << "Check by: ... missing third point ..." << endl);1135 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);1136 }1137 1184 } 1138 1185 return flag; … … 3313 3360 } 3314 3361 } else { 3315 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);3362 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); 3316 3363 } 3317 3364 } else { … … 4613 4660 4614 4661 DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl); 4615 IndexToIndex::iterator it; 4616 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 4662 for (IndexToIndex::iterator it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 4617 4663 DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl); 4618 4664 … … 4632 4678 int count = 0; 4633 4679 4634 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); TriangleKeyRunner != DegeneratedTriangles->end(); ++TriangleKeyRunner) { 4680 // iterate over all degenerated triangles 4681 for (IndexToIndex::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); !DegeneratedTriangles->empty(); TriangleKeyRunner = DegeneratedTriangles->begin()) { 4682 DoLog(0) && (Log() << Verbose(0) << "Checking presence of triangles " << TriangleKeyRunner->first << " and " << TriangleKeyRunner->second << "." << endl); 4683 // both ways are stored in the map, only use one 4684 if (TriangleKeyRunner->first > TriangleKeyRunner->second) 4685 continue; 4686 4687 // determine from the keys in the map the two _present_ triangles 4635 4688 finder = TrianglesOnBoundary.find(TriangleKeyRunner->first); 4636 4689 if (finder != TrianglesOnBoundary.end()) 4637 4690 triangle = finder->second; 4638 4691 else 4639 break;4692 continue; 4640 4693 finder = TrianglesOnBoundary.find(TriangleKeyRunner->second); 4641 4694 if (finder != TrianglesOnBoundary.end()) 4642 4695 partnerTriangle = finder->second; 4643 4696 else 4644 break; 4645 4697 continue; 4698 4699 // determine which lines are shared by the two triangles 4646 4700 bool trianglesShareLine = false; 4647 4701 for (int i = 0; i < 3; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.
