Changeset 2130dd


Ignore:
Timestamp:
Nov 28, 2009, 3:48:41 PM (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:
73b510
Parents:
af374d (diff), 856098 (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.
Message:

Merge branch 'FixDegeneratedTesselation' into CorrectDegeneratedPolygons

Conflicts:

molecuilder/src/tesselation.cpp

merge only necessary due to stupid git commit --amend

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    raf374d r2130dd  
    41324132  /// 2. Go through all lines not contained in degenerated triangles.
    41334133  UniquePolygonSet ListofFours;
     4134  UniquePolygonSet TestedPolygons;
    41344135  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) {
    41354136    Log() << Verbose(1) << "Current Line is: " << *(LineRunner->second) << endl;
     
    41484149    TriangleSet *T = Four->GetAllContainedTrianglesFromEndpoints();
    41494150
    4150     /// 2c. check whether triangles are not already simply degenerated.
     4151    /// 2c1. Check whether all triangles have (besides sign) same normal vector)
     4152    TriangleSet::const_iterator Runner = T->begin();
     4153    Vector NormalVector;
     4154    NormalVector.CopyVector(&(*Runner)->NormalVector);
     4155    Runner++;
     4156    bool IsPlanar = true;
     4157    for (; Runner != T->end(); Runner++) {
     4158      if (fabs(fabs(NormalVector.ScalarProduct(&(*Runner)->NormalVector)) - 1.) > MYEPSILON)  // check whether all NormalVectors are parallel
     4159        IsPlanar = false;
     4160    }
     4161
     4162    /// 2c2. check whether triangles are not already simply degenerated.
    41514163    size_t DegeneratedCount = 0;
    41524164    for (TriangleSet::const_iterator Runner = T->begin(); Runner != T->end(); Runner++) {
     
    41554167    }
    41564168    Log() << Verbose(1) << "Found " << DegeneratedCount << " degenerated triangles." << endl;
    4157     if (DegeneratedCount == 0) {
    4158       /// 2c. Find all pairs of those triangles that contain the four endpoints
    4159       const int counter = CountTrianglePairContainingPolygon(Four, T);
    4160       Log() << Verbose(1) << "There are " << counter << " pairs for this polygon of four." << endl;
    4161       if (counter %3 == 0) {
    4162         /// 2d. Check the number of pairs, if greater 1, we have a degenerated polygon (mark down for later use)
    4163         pair < UniquePolygonSet::iterator, bool > Tester = ListofFours.insert(Four);
    4164         if (Tester.second) {
    4165           Log() << Verbose(0) << "ACCEPT: We have a degenerated polygon." << *Four << endl;
     4169
     4170    if (IsPlanar) {
     4171      if(DegeneratedCount == 0) {
     4172        /// 2c. Find all pairs of those triangles that contain the four endpoints
     4173        const int counter = CountTrianglePairContainingPolygon(Four, T);
     4174        Log() << Verbose(1) << "There are " << counter << " pairs for this polygon of four." << endl;
     4175        if (counter %3 == 0) {
     4176          /// 2d. Check the number of pairs, if greater 1, we have a degenerated polygon (mark down for later use)
     4177          pair < UniquePolygonSet::iterator, bool > Tester = ListofFours.insert(Four);
     4178          if (Tester.second) {
     4179            Log() << Verbose(0) << "ACCEPT: We have a degenerated polygon." << *Four << endl;
     4180          } else {
     4181            Log() << Verbose(0) << "REJECT: Degenerated polygon already present." << *Four << endl;
     4182            delete(Four);
     4183          }
    41664184        } else {
    4167           Log() << Verbose(0) << "REJECT: Degenerated polygon already present." << *Four << endl;
     4185          Log() << Verbose(0) << "REJECT: Seems to be the edge line of a degenerated polygon only." << *Four << endl;
    41684186          delete(Four);
    41694187        }
    41704188      } else {
    4171         Log() << Verbose(0) << "REJECT: Seems to be the edge line of a degenerated polygon only." << *Four << endl;
     4189        Log() << Verbose(0) << "REJECT: This polygon contains some simply degenerated triangles." << endl;
    41724190        delete(Four);
    41734191      }
    41744192    } else {
    4175       Log() << Verbose(0) << "REJECT: This polygon contains some simply degenerated triangles." << endl;
     4193      Log() << Verbose(0) << "REJECT: This polygon does not lay on a plane." << endl;
    41764194      delete(Four);
    41774195    }
Note: See TracChangeset for help on using the changeset viewer.