Changeset fcad4b
- Timestamp:
- Jan 11, 2010, 3:06:30 AM (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:
- fee69b
- Parents:
- 68a53b
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
r68a53b rfcad4b 420 420 if (CrossPoint.GetIntersectionOfTwoLinesOnPlane(endpoints[i%3]->node->node, endpoints[(i+1)%3]->node->node, endpoints[(i+2)%3]->node->node, Intersection, &NormalVector)) { 421 421 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector 422 helper.CopyVector(endpoints[(i+1)%3]->node->node);423 helper.SubtractVector(endpoints[i%3]->node->node);422 i++; 423 } else 424 424 break; 425 } else426 i++;427 425 } while (i<3); 428 426 if (i==3) { 429 eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl; 430 } 431 Log() << Verbose(1) << "INFO: Crosspoint is " << CrossPoint << "." << endl; 432 433 // check whether intersection is inside or not by comparing length of intersection and length of cross point 434 if ((CrossPoint.NormSquared() - helper.NormSquared()) < MYEPSILON) { // inside 427 Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl; 435 428 return true; 436 } else { // outside!437 Intersection->Zero();429 } else { 430 Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl; 438 431 return false; 439 432 } … … 3241 3234 bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC, const double epsilon) const 3242 3235 { 3243 3236 Info FunctionInfo(__func__); 3244 3237 class BoundaryTriangleSet *result = FindClosestTriangleToVector(&Point, LC); 3245 3238 Vector Center; … … 3252 3245 return false; 3253 3246 } else { 3254 Log() << Verbose(1) << "INFO: Closest triangle found is " << *result << " ." << endl;3247 Log() << Verbose(1) << "INFO: Closest triangle found is " << *result << " with normal vector " << result->NormalVector << "." << endl; 3255 3248 } 3256 3249 … … 3259 3252 DistanceToCenter.CopyVector(&Center); 3260 3253 DistanceToCenter.SubtractVector(&Point); 3261 Log() << Verbose(2) << "INFO: Vector from point to test to center is " << Center << "." << endl;3254 Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl; 3262 3255 3263 3256 // check whether we are on boundary 3264 3257 if (fabs(DistanceToCenter.ScalarProduct(&result->NormalVector)) < MYEPSILON) { 3265 3258 // calculate whether inside of triangle 3266 DistanceToCenter.ProjectOntoPlane(&result->NormalVector); 3267 DistanceToCenter.AddVector(&Center); 3268 Center.CopyVector(&DistanceToCenter); 3259 DistanceToCenter.CopyVector(&Point); 3260 Center.CopyVector(&Point); 3269 3261 Center.SubtractVector(&result->NormalVector); // points towards MolCenter 3270 3262 DistanceToCenter.AddVector(&result->NormalVector); // points outside -
src/vector.cpp
r68a53b rfcad4b 319 319 M->Set(3, i, Line2b->x[i]); 320 320 } 321 if (fabs(M->Determinant()) < MYEPSILON) 321 Log() << Verbose(1) << "Coefficent matrix is:" << endl; 322 for (int i=0;i<4;i++) { 323 for (int j=0;j<4;j++) 324 cout << "\t" << M->Get(i,j); 325 cout << endl; 326 } 327 if (fabs(M->Determinant()) > MYEPSILON) { 328 Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl; 322 329 return false; 330 } 331 Log() << Verbose(1) << "INFO: Line1a = " << *Line1a << ", Line1b = " << *Line1b << ", Line2a = " << *Line2a << ", Line2b = " << *Line2b << "." << endl; 332 323 333 324 334 // constuct a,b,c … … 329 339 c.CopyVector(Line2a); 330 340 c.SubtractVector(Line1a); 341 Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl; 342 343 // check for parallelity 344 Vector parallel; 345 parallel.CopyVector(&a); 346 parallel.SubtractVector(&b); 347 if (parallel.NormSquared() < MYEPSILON) { 348 Log() << Verbose(1) << "Lines are parallel." << endl; 349 return false; 350 } 331 351 332 352 // obtain s … … 337 357 temp2.CopyVector(&a); 338 358 temp2.VectorProduct(&b); 339 s = temp1.ScalarProduct(&temp2)/temp2.NormSquared(); 340 Log() << Verbose(1) << "Factor s is " << s << "." << endl; 359 Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl; 360 if (fabs(temp2.NormSquared()) > MYEPSILON) 361 s = temp1.ScalarProduct(&temp2)/temp2.NormSquared(); 362 else 363 s = 0.; 364 Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(&temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl; 341 365 342 366 // construct intersection … … 346 370 Log() << Verbose(1) << "Intersection is at " << *this << "." << endl; 347 371 348 return true; 372 if ((s >=0 ) && (s<=1)) 373 return true; 374 else 375 return false; 349 376 }; 350 377
Note:
See TracChangeset
for help on using the changeset viewer.