Changeset 1953f9 for src/tesselation.cpp


Ignore:
Timestamp:
Aug 7, 2009, 9:12:19 AM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
f3278b
Parents:
9f97c5
Message:

FIX: We have to check whether we create a degenerate triangle also on its first occurence! I.e. in all cases we don't want to create two lines in place were one is already with two triangles attached.

This fixed a bug with cholesterol immediately.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r9f97c5 r1953f9  
    11011101;
    11021102
    1103 
    1104 
    11051103/** Checks whether the triangle consisting of the three points is already present.
    11061104 * Searches for the points in Tesselation::PointsOnBoundary and checks their
     
    13271325  cout << Verbose(0) << "Begin of Find_next_suitable_triangle\n";
    13281326  bool result = true;
     1327  bool degenerateTriangle = false;
    13291328  CandidateList *Opt_Candidates = new CandidateList();
    13301329
     
    14231422      AddTrianglePoint(BaseRay->endpoints[1]->node, 2);
    14241423
    1425       AddTriangleLine(TPS[0], TPS[1], 0);
    1426       AddTriangleLine(TPS[0], TPS[2], 1);
    1427       AddTriangleLine(TPS[1], TPS[2], 2);
    1428 
    1429       BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1430       AddTriangle();
    1431       (*it)->OptCenter.Scale(-1.);
    1432       BTS->GetNormalVector((*it)->OptCenter);
    1433       (*it)->OptCenter.Scale(-1.);
    1434 
    1435       cout << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    1436         << " for this triangle ... " << endl;
     1424      if (CheckLineCriteriaforDegeneratedTriangle(TPS)) {
     1425        AddTriangleLine(TPS[0], TPS[1], 0);
     1426        AddTriangleLine(TPS[0], TPS[2], 1);
     1427        AddTriangleLine(TPS[1], TPS[2], 2);
     1428
     1429        BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
     1430        AddTriangle();
     1431        (*it)->OptCenter.Scale(-1.);
     1432        BTS->GetNormalVector((*it)->OptCenter);
     1433        (*it)->OptCenter.Scale(-1.);
     1434
     1435        cout << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
     1436          << " for this triangle ... " << endl;
    14371437      //cout << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
     1438      } else {
     1439        cout << Verbose(1) << "WARNING: This triangle consisting of ";
     1440        cout << *(*it)->point << ", ";
     1441        cout << *BaseRay->endpoints[0]->node << " and ";
     1442        cout << *BaseRay->endpoints[1]->node << " ";
     1443        cout << "exists and is not added, as it does not seem helpful!" << endl;
     1444        result = false;
     1445      }
    14381446    } else if (existentTrianglesCount == 1) { // If there is a planar region within the structure, we need this triangle a second time.
    14391447        AddTrianglePoint((*it)->point, 0);
     
    14491457
    14501458          BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1451           AddTriangle();
     1459          AddTriangle();  // add to global map
    14521460
    14531461          (*it)->OtherOptCenter.Scale(-1.);
     
    18021810
    18031811                // check for three unique points
    1804                 //cout << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->x << "." << endl;
     1812                //cout << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
    18051813                if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){
    18061814
     
    18631871                      } else {
    18641872                        if ((optCandidate != NULL) && (optCandidate->point != NULL)) {
    1865                           //cout << Verbose(2) << "REJECT: Old candidate: " << *(optCandidate->point) << " is better than " << alpha << " with " << *ShortestAngle << "." << endl;
     1873                          //cout << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    18661874                        } else {
    18671875                          //cout << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     
    18701878
    18711879                    } else {
    1872                       //cout << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " is too far away: " << radius << "." << endl;
     1880                      //cout << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
    18731881                    }
    18741882                  } else {
Note: See TracChangeset for help on using the changeset viewer.