Changeset 76c0d6 for src/tesselation.cpp
- Timestamp:
- Jun 4, 2010, 9:28:46 AM (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:
- 2c8934
- Parents:
- e05826 (diff), 27ac00 (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. - File:
-
- 1 edited
-
src/tesselation.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
re05826 r76c0d6 17 17 #include "triangleintersectionlist.hpp" 18 18 #include "vector.hpp" 19 #include "Line.hpp" 19 20 #include "vector_ops.hpp" 20 21 #include "verbose.hpp" … … 441 442 442 443 try { 443 *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*MolCenter, *x); 444 } 445 catch (LinearDependenceException &excp) { 446 Log() << Verbose(1) << excp; 447 DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl); 448 return false; 449 } 450 451 DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl); 452 DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl); 453 DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl); 454 455 if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) { 456 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl); 457 return true; 458 } else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) { 459 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl); 460 return true; 461 } else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) { 462 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl); 463 return true; 464 } 465 // Calculate cross point between one baseline and the line from the third endpoint to intersection 466 int i = 0; 467 do { 468 try { 469 CrossPoint = GetIntersectionOfTwoLinesOnPlane(*(endpoints[i%3]->node->node), 470 *(endpoints[(i+1)%3]->node->node), 471 *(endpoints[(i+2)%3]->node->node), 472 *Intersection); 444 Line centerLine = makeLineThrough(*MolCenter, *x); 445 *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(centerLine); 446 447 DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl); 448 DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl); 449 DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl); 450 451 if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) { 452 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl); 453 return true; 454 } else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) { 455 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl); 456 return true; 457 } else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) { 458 DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl); 459 return true; 460 } 461 // Calculate cross point between one baseline and the line from the third endpoint to intersection 462 int i = 0; 463 do { 464 Line line1 = makeLineThrough(*(endpoints[i%3]->node->node),*(endpoints[(i+1)%3]->node->node)); 465 Line line2 = makeLineThrough(*(endpoints[(i+2)%3]->node->node),*Intersection); 466 CrossPoint = line1.getIntersection(line2); 473 467 helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node); 474 468 CrossPoint -= (*endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 477 471 if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) { 478 472 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl); 479 i=4; 480 break; 473 return false; 481 474 } 482 475 i++; 483 } catch (LinearDependenceException &excp){ 484 break; 485 } 486 } while (i < 3); 487 if (i == 3) { 476 } while (i < 3); 488 477 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl); 489 478 return true; 490 } else { 491 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl); 479 } 480 catch (MathException &excp) { 481 Log() << Verbose(1) << excp; 482 DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl); 492 483 return false; 493 484 } … … 516 507 GetCenter(&Direction); 517 508 try { 518 *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*x, Direction); 519 } 520 catch (LinearDependenceException &excp) { 509 Line l = makeLineThrough(*x, Direction); 510 *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(l); 511 } 512 catch (MathException &excp) { 521 513 (*ClosestPoint) = (*x); 522 514 } … … 541 533 Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node); 542 534 // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal); 543 CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node)); 535 Line l = makeLineThrough(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node)); 536 CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l); 544 537 CrossDirection[i] = CrossPoint[i] - InPlane; 545 538 CrossPoint[i] -= (*endpoints[i%3]->node->node); // cross point was returned as absolute vector
Note:
See TracChangeset
for help on using the changeset viewer.
