Changeset 7dea7c


Ignore:
Timestamp:
Oct 2, 2009, 3:19:51 PM (16 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:
a33931, aba92d
Parents:
e4a379
Message:

Fixes to the (Non)ConvexTesselation, working with 1_2_dimethoxyethylene

minor changes:

major changes:

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    re4a379 r7dea7c  
    572572
    573573  // third step: IsConvexRectangle
    574   LineRunner = TesselStruct->LinesOnBoundary.begin();
    575   LineAdvance = LineRunner;  // we need an advanced line, as the LineRunner might get removed
    576   while (LineRunner != TesselStruct->LinesOnBoundary.end()) {
    577     LineAdvance++;
    578     line = LineRunner->second;
    579     *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;
    580     //if (LineAdvance != TesselStruct->LinesOnBoundary.end())
    581       //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;
    582     if (!line->CheckConvexityCriterion(out)) {
    583       *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;
    584 
    585       // take highest of both lines
    586       point = TesselStruct->IsConvexRectangle(out, line);
    587       if (point != NULL)
    588         volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);
    589     }
    590     LineRunner = LineAdvance;
    591   }
     574//  LineRunner = TesselStruct->LinesOnBoundary.begin();
     575//  LineAdvance = LineRunner;  // we need an advanced line, as the LineRunner might get removed
     576//  while (LineRunner != TesselStruct->LinesOnBoundary.end()) {
     577//    LineAdvance++;
     578//    line = LineRunner->second;
     579//    *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;
     580//    //if (LineAdvance != TesselStruct->LinesOnBoundary.end())
     581//      //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;
     582//    if (!line->CheckConvexityCriterion(out)) {
     583//      *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;
     584//
     585//      // take highest of both lines
     586//      point = TesselStruct->IsConvexRectangle(out, line);
     587//      if (point != NULL)
     588//        volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);
     589//    }
     590//    LineRunner = LineAdvance;
     591//  }
    592592
    593593  CalculateConcavityPerBoundaryPoint(out, TesselStruct);
     
    600600};
    601601
    602 /** Calculates the concavity for each of the BoundaryPointSet's in a Tesselation.
    603  * Sets BoundaryPointSet::value equal to the number of connected lines that are not convex.
    604  * \param *out output stream for debugging
    605  * \param *TesselStruct pointer to Tesselation structure
    606  */
    607 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct)
    608 {
    609   class BoundaryPointSet *point = NULL;
    610   class BoundaryLineSet *line = NULL;
    611   // calculate remaining concavity
    612   for (PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
    613     point = PointRunner->second;
    614     *out << Verbose(1) << "INFO: Current point is " << *point << "." << endl;
    615     point->value = 0;
    616     for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    617       line = LineRunner->second;
    618       *out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    619       if (!line->CheckConvexityCriterion(out))
    620         point->value += 1;
    621     }
    622   }
    623 };
    624 
    625 /** Stores triangles to file.
    626  * \param *out output stream for debugging
    627  * \param *mol molecule with atoms and bonds
    628  * \param *filename prefix of filename
    629  * \param *extraSuffix intermediate suffix
    630  */
    631 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)
    632 {
    633   // 4. Store triangles in tecplot file
    634   if (filename != NULL) {
    635     if (DoTecplotOutput) {
    636       string OutputName(filename);
    637       OutputName.append(extraSuffix);
    638       OutputName.append(TecplotSuffix);
    639       ofstream *tecplot = new ofstream(OutputName.c_str());
    640       WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
    641       tecplot->close();
    642       delete(tecplot);
    643     }
    644     if (DoRaster3DOutput) {
    645       string OutputName(filename);
    646       OutputName.append(extraSuffix);
    647       OutputName.append(Raster3DSuffix);
    648       ofstream *rasterplot = new ofstream(OutputName.c_str());
    649       WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
    650       rasterplot->close();
    651       delete(rasterplot);
    652     }
    653   }
    654 };
    655602
    656603/** Determines the volume of a cluster.
     
    699646
    700647  return volume;
    701 }
    702 ;
     648};
     649
     650/** Stores triangles to file.
     651 * \param *out output stream for debugging
     652 * \param *mol molecule with atoms and bonds
     653 * \param *filename prefix of filename
     654 * \param *extraSuffix intermediate suffix
     655 */
     656void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)
     657{
     658  // 4. Store triangles in tecplot file
     659  if (filename != NULL) {
     660    if (DoTecplotOutput) {
     661      string OutputName(filename);
     662      OutputName.append(extraSuffix);
     663      OutputName.append(TecplotSuffix);
     664      ofstream *tecplot = new ofstream(OutputName.c_str());
     665      WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
     666      tecplot->close();
     667      delete(tecplot);
     668    }
     669    if (DoRaster3DOutput) {
     670      string OutputName(filename);
     671      OutputName.append(extraSuffix);
     672      OutputName.append(Raster3DSuffix);
     673      ofstream *rasterplot = new ofstream(OutputName.c_str());
     674      WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
     675      rasterplot->close();
     676      delete(rasterplot);
     677    }
     678  }
     679};
    703680
    704681/** Creates multiples of the by \a *mol given cluster and suspends them in water with a given final density.
     
    990967void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL)
    991968{
    992   int N = 0;
    993969  bool freeLC = false;
    994970
     
    1005981  LineMap::iterator testline;
    1006982  *out << Verbose(0) << "Begin of FindNonConvexBorder\n";
    1007   bool flag = false;  // marks whether we went once through all baselines without finding any without two triangles
    1008   bool failflag = false;
     983  bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
     984  bool TesselationFailFlag = false;
    1009985
    1010986  // initialise Linked Cell
     
    1020996  baseline = mol->TesselStruct->LinesOnBoundary.begin();
    1021997  baseline++; // skip first line
    1022   while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (flag)) {
     998  while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    1023999    if (baseline->second->triangles.size() == 1) {
    10241000      // 3. find next triangle
    1025       failflag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    1026       flag = flag || failflag;
    1027       if (!failflag)
     1001      TesselationFailFlag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
     1002      OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
     1003      if (!TesselationFailFlag)
    10281004        cerr << "WARNING: FindNextSuitableTriangle failed." << endl;
    10291005
    10301006      // write temporary envelope
    10311007      if (filename != NULL) {
    1032         if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0) || (mol->TesselStruct->TrianglesOnBoundary.size() > 8520 && mol->TesselStruct->TrianglesOnBoundary.size() <= 8530)))) { // if we have a new triangle and want to output each new triangle configuration
     1008        if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    10331009          mol->TesselStruct->Output(out, filename, mol);
    10341010        }
    10351011      }
    10361012      baseline = mol->TesselStruct->LinesOnBoundary.end();
     1013      *out << Verbose(2) << "Baseline set to end." << endl;
    10371014    } else {
    10381015      //cout << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
     
    10411018    }
    10421019
    1043     N++;
    1044     if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (flag)) {
     1020    if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    10451021      baseline = mol->TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    1046       baseline++;
    1047       flag = false;
    1048     }
    1049   }
     1022      OneLoopWithoutSuccessFlag = false;
     1023    }
     1024    baseline++;
     1025  }
     1026  // check envelope for consistency
     1027  CheckListOfBaselines(out, mol->TesselStruct);
     1028
    10501029  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    10511030  mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList);
     
    10671046  mol->TesselStruct->RemoveDegeneratedTriangles();
    10681047
    1069   cout << Verbose(2) << "Check: List of Baselines with not two connected triangles:" << endl;
    1070   int counter = 0;
    1071   for (testline = mol->TesselStruct->LinesOnBoundary.begin(); testline != mol->TesselStruct->LinesOnBoundary.end(); testline++) {
    1072     if (testline->second->triangles.size() != 2) {
    1073       cout << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
    1074       counter++;
    1075     }
    1076   }
    1077   if (counter == 0)
    1078     *out << Verbose(2) << "None." << endl;
     1048  // check envelope for consistency
     1049  CheckListOfBaselines(out, mol->TesselStruct);
    10791050
    10801051  // write final envelope
  • src/boundary.hpp

    re4a379 r7dea7c  
    3636void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
    3737Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol);
    38 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct);
    3938void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix);
    4039bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation *TesselStruct, molecule *mol, char *filename);
  • src/tesselation.cpp

    re4a379 r7dea7c  
    215215    node = runner->second->GetThirdEndpoint(this);
    216216    if (node != NULL) {
    217       *out << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
     217      //*out << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    218218      helper[i].CopyVector(node->node->node);
    219219      helper[i].SubtractVector(&BaseLineCenter);
    220220      helper[i].MakeNormalVector(&BaseLine);  // we want to compare the triangle's heights' angles!
    221       *out << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
     221      //*out << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    222222      i++;
    223223    } else {
     
    226226    }
    227227  }
    228   *out << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
     228  //*out << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    229229  if (NormalCheck.NormSquared() < MYEPSILON) {
    230230    *out << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
     
    374374 * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
    375375 * This we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    376  * The latter is done as follows: if it's really outside, then for any endpoint of the triangle and it's opposite
    377  * base line, the intersection between the line from endpoint to intersection and the base line will have a Vector::NormSquared()
    378  * smaller than the first line.
     376 * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
     377 * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
     378 * the first two basepoints) or not.
    379379 * \param *out output stream for debugging
    380380 * \param *MolCenter offset vector of line
     
    408408    exit(255);
    409409  }
    410   CrossPoint.SubtractVector(endpoints[i%3]->node->node);
     410  CrossPoint.SubtractVector(endpoints[i%3]->node->node);  // cross point was returned as absolute vector
    411411
    412412  // check whether intersection is inside or not by comparing length of intersection and length of cross point
    413   if ((CrossPoint.NormSquared() - helper.NormSquared()) > -MYEPSILON) { // inside
     413  if ((CrossPoint.NormSquared() - helper.NormSquared()) < MYEPSILON) { // inside
    414414    return true;
    415415  } else { // outside!
     
    439439  for(int i=0;i<3;i++)
    440440    if (point == endpoints[i])
     441      return true;
     442  return false;
     443};
     444
     445/** Checks whether point is any of the three endpoints this triangle contains.
     446 * \param *point TesselPoint to test
     447 * \return true - point is of the triangle, false - is not
     448 */
     449bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point)
     450{
     451  for(int i=0;i<3;i++)
     452    if (point == endpoints[i]->node)
    441453      return true;
    442454  return false;
     
    10881100  Vector *Center = cloud->GetCenter(out);
    10891101  list<BoundaryTriangleSet*> *triangles = NULL;
     1102  bool AddFlag = false;
     1103  LinkedCell *BoundaryPoints = NULL;
    10901104
    10911105  *out << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
    10921106
    10931107  cloud->GoToFirst();
     1108  BoundaryPoints = new LinkedCell(this, 5.);
    10941109  while (!cloud->IsEnd()) {  // we only have to go once through all points, as boundary can become only bigger
    1095     LinkedCell BoundaryPoints(this, 5.);
     1110    if (AddFlag) {
     1111      delete(BoundaryPoints);
     1112      BoundaryPoints = new LinkedCell(this, 5.);
     1113      AddFlag = false;
     1114    }
    10961115    Walker = cloud->GetPoint();
    10971116    *out << Verbose(2) << "Current point is " << *Walker << "." << endl;
    10981117    // get the next triangle
    1099     triangles = FindClosestTrianglesToPoint(out, Walker->node, &BoundaryPoints);
    1100     if (triangles == NULL) {
    1101       *out << Verbose(1) << "No triangles found, probably a tesselation point itself." << endl;
     1118    triangles = FindClosestTrianglesToPoint(out, Walker->node, BoundaryPoints);
     1119    BTS = triangles->front();
     1120    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
     1121      *out << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl;
    11021122      cloud->GoToNext();
    11031123      continue;
    11041124    } else {
    1105       BTS = triangles->front();
    11061125    }
    11071126    *out << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
     
    11261145        // add Walker to boundary points
    11271146        *out << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1147        AddFlag = true;
    11281148        if (AddBoundaryPoint(Walker,0))
    11291149          NewPoint = BPS[0];
     
    12791299};
    12801300
    1281 /** Function tries to add Triangle just created to Triangle and remarks if already existent (Failure of algorithm).
    1282  * Furthermore it adds the triangle to all of its lines, in order to recognize those which are saturated later.
     1301/** Function adds triangle to global list.
     1302 * Furthermore, the triangle receives the next free id and id counter \a TrianglesOnBoundaryCount is increased.
    12831303 */
    12841304void Tesselation::AddTesselationTriangle()
     
    12891309  TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    12901310  TrianglesOnBoundaryCount++;
     1311
     1312  // set as last new triangle
     1313  LastTriangle = BTS;
     1314
     1315  // NOTE: add triangle to local maps is done in constructor of BoundaryTriangleSet
     1316};
     1317
     1318/** Function adds triangle to global list.
     1319 * Furthermore, the triangle number is set to \a nr.
     1320 * \param nr triangle number
     1321 */
     1322void Tesselation::AddTesselationTriangle(int nr)
     1323{
     1324  cout << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1325
     1326  // add triangle to global map
     1327  TrianglesOnBoundary.insert(TrianglePair(nr, BTS));
    12911328
    12921329  // set as last new triangle
     
    20972134    BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[0]);
    20982135    BTS->GetNormalVector(BaseLineNormal);
    2099     TrianglesOnBoundary.insert(TrianglePair(OldTriangleNrs[0], BTS));
     2136    AddTesselationTriangle(OldTriangleNrs[0]);
    21002137    *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
    21012138
     
    21052142    BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[1]);
    21062143    BTS->GetNormalVector(BaseLineNormal);
    2107     TrianglesOnBoundary.insert(TrianglePair(OldTriangleNrs[1], BTS));
     2144    AddTesselationTriangle(OldTriangleNrs[1]);
    21082145    *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
    21092146  } else {
     
    24812518  }
    24822519  if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) {
    2483     *out << Verbose(2) << "Point is right on a tesselation point, no nearest triangle." << endl;
     2520    *out << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
    24842521    PointMap::iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr);
    24852522    triangles = new list<BoundaryTriangleSet*>;
     
    25122549        *out << Verbose(1) << "ERROR: IsInnerPoint encounters serious error, point " << i << " not found." << endl;
    25132550      }
    2514       *out << Verbose(1) << "List of triangle points:" << endl;
    2515       *out << Verbose(2) << *trianglePoints[i] << endl;
     2551      //*out << Verbose(2) << "List of triangle points:" << endl;
     2552      //*out << Verbose(3) << *trianglePoints[i] << endl;
    25162553    }
    25172554
    25182555    triangles = FindTriangles(trianglePoints);
    2519     *out << Verbose(1) << "List of possible triangles:" << endl;
     2556    *out << Verbose(2) << "List of possible triangles:" << endl;
    25202557    for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2521       *out << Verbose(2) << **Runner << endl;
     2558      *out << Verbose(3) << **Runner << endl;
    25222559
    25232560    delete(connectedClosestPoints);
     
    32993336  int count  = 0;
    33003337
     3338  cout << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
     3339
    33013340  for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin();
    33023341    TriangleKeyRunner != DegeneratedTriangles->end(); ++TriangleKeyRunner
     
    33703409
    33713410  cout << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
     3411  cout << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
    33723412}
    33733413
  • src/tesselation.hpp

    re4a379 r7dea7c  
    126126    bool ContainsBoundaryLine(class BoundaryLineSet *line);
    127127    bool ContainsBoundaryPoint(class BoundaryPointSet *point);
     128    bool ContainsBoundaryPoint(class TesselPoint *point);
    128129    class BoundaryPointSet *GetThirdEndpoint(class BoundaryLineSet *line);
    129130    bool IsPresentTupel(class BoundaryPointSet *Points[3]);
     
    204205    void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
    205206    void AddTesselationTriangle();
     207    void AddTesselationTriangle(int nr);
    206208    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    207209    void RemoveTesselationLine(class BoundaryLineSet *line);
  • src/tesselationhelpers.cpp

    re4a379 r7dea7c  
    598598  for(int i=0;i<NDIM;i++) // store indices of this cell
    599599    N[i] = LC->n[i];
    600   cout << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     600  cout << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    601601
    602602  LC->GetNeighbourBounds(Nlower, Nupper);
     
    828828  }
    829829};
     830
     831/** Calculates the concavity for each of the BoundaryPointSet's in a Tesselation.
     832 * Sets BoundaryPointSet::value equal to the number of connected lines that are not convex.
     833 * \param *out output stream for debugging
     834 * \param *TesselStruct pointer to Tesselation structure
     835 */
     836void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct)
     837{
     838  class BoundaryPointSet *point = NULL;
     839  class BoundaryLineSet *line = NULL;
     840
     841  //*out << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;
     842  // calculate remaining concavity
     843  for (PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
     844    point = PointRunner->second;
     845    *out << Verbose(1) << "INFO: Current point is " << *point << "." << endl;
     846    point->value = 0;
     847    for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
     848      line = LineRunner->second;
     849      //*out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     850      if (!line->CheckConvexityCriterion(out))
     851        point->value += 1;
     852    }
     853  }
     854  //*out << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;
     855};
     856
     857
     858/** Checks whether each BoundaryLineSet in the Tesselation has two triangles.
     859 * \param *out output stream for debugging
     860 * \param *TesselStruct
     861 * \return true - all have exactly two triangles, false - some not, list is printed to screen
     862 */
     863bool CheckListOfBaselines(ofstream *out, Tesselation *TesselStruct)
     864{
     865  LineMap::iterator testline;
     866  bool result = false;
     867  int counter = 0;
     868
     869  *out << Verbose(1) << "Check: List of Baselines with not two connected triangles:" << endl;
     870  for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) {
     871    if (testline->second->triangles.size() != 2) {
     872      *out << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl;
     873      counter++;
     874    }
     875  }
     876  if (counter == 0) {
     877    *out << Verbose(1) << "None." << endl;
     878    result = true;
     879  }
     880  return result;
     881}
     882
  • src/tesselationhelpers.hpp

    re4a379 r7dea7c  
    5050void IncludeSphereinRaster3D(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, PointCloud *cloud);
    5151void WriteVrmlFile(ofstream *out, ofstream *vrmlfile, class Tesselation *Tess, PointCloud *cloud);
     52void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct);
     53
     54bool CheckListOfBaselines(ofstream *out, Tesselation *TesselStruct);
    5255
    5356
Note: See TracChangeset for help on using the changeset viewer.