Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    rb998c3 rfad93c  
    879879CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
    880880    BaseLine(line),
    881     IsDegenerated(false),
    882881    ShortestAngle(2.*M_PI),
    883882    OtherShortestAngle(2.*M_PI)
     
    15881587  bool insertNewLine = true;
    15891588
    1590   LineMap::iterator FindLine = a->lines.find(b->node->nr);
    1591   if (FindLine != a->lines.end()) {
    1592     Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
    1593 
     1589  if (a->lines.find(b->node->nr) != a->lines.end()) {
     1590    LineMap::iterator FindLine = a->lines.find(b->node->nr);
    15941591    pair<LineMap::iterator,LineMap::iterator> FindPair;
    15951592    FindPair = a->lines.equal_range(b->node->nr);
     1593    Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
    15961594
    15971595    for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
     
    19171915  double maxCoordinate[NDIM];
    19181916  BoundaryLineSet BaseLine;
     1917  Vector Oben;
    19191918  Vector helper;
    19201919  Vector Chord;
    19211920  Vector SearchDirection;
    1922   Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
    1923   Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in
    1924   Vector SphereCenter;
    1925   Vector NormalVector;
    1926 
    1927   NormalVector.Zero();
     1921
     1922  Oben.Zero();
    19281923
    19291924  for (i = 0; i < 3; i++) {
     
    19601955  BTS = NULL;
    19611956  for (int k=0;k<NDIM;k++) {
    1962     NormalVector.Zero();
    1963     NormalVector.x[k] = 1.;
     1957    Oben.Zero();
     1958    Oben.x[k] = 1.;
    19641959    BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]);
    19651960    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
     
    19681963    ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant.
    19691964
    1970     FindSecondPointForTesselation(BaseLine.endpoints[0]->node, NormalVector, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
     1965    FindSecondPointForTesselation(BaseLine.endpoints[0]->node, Oben, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
    19711966    if (Temporary == NULL)  // have we found a second point?
    19721967      continue;
    19731968    BaseLine.endpoints[1] = new BoundaryPointSet(Temporary);
    19741969
    1975     // construct center of circle
    1976     CircleCenter.CopyVector(BaseLine.endpoints[0]->node->node);
    1977     CircleCenter.AddVector(BaseLine.endpoints[1]->node->node);
    1978     CircleCenter.Scale(0.5);
    1979 
    1980     // construct normal vector of circle
    1981     CirclePlaneNormal.CopyVector(BaseLine.endpoints[0]->node->node);
    1982     CirclePlaneNormal.SubtractVector(BaseLine.endpoints[1]->node->node);
    1983 
    1984     double radius = CirclePlaneNormal.NormSquared();
     1970    helper.CopyVector(BaseLine.endpoints[0]->node->node);
     1971    helper.SubtractVector(BaseLine.endpoints[1]->node->node);
     1972    helper.Normalize();
     1973    Oben.ProjectOntoPlane(&helper);
     1974    Oben.Normalize();
     1975    helper.VectorProduct(&Oben);
     1976    ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
     1977
     1978    Chord.CopyVector(BaseLine.endpoints[0]->node->node); // bring into calling function
     1979    Chord.SubtractVector(BaseLine.endpoints[1]->node->node);
     1980    double radius = Chord.ScalarProduct(&Chord);
    19851981    double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.);
    1986 
    1987     NormalVector.ProjectOntoPlane(&CirclePlaneNormal);
    1988     NormalVector.Normalize();
    1989     ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    1990 
    1991     SphereCenter.CopyVector(&NormalVector);
    1992     SphereCenter.Scale(CircleRadius);
    1993     SphereCenter.AddVector(&CircleCenter);
    1994     // Now, NormalVector and SphereCenter are two orthonormalized vectors in the plane defined by CirclePlaneNormal (not normalized)
     1982    helper.CopyVector(&Oben);
     1983    helper.Scale(CircleRadius);
     1984    // Now, oben and helper are two orthonormalized vectors in the plane defined by Chord (not normalized)
    19951985
    19961986    // look in one direction of baseline for initial candidate
    1997     SearchDirection.MakeNormalVector(&CirclePlaneNormal, &NormalVector);  // whether we look "left" first or "right" first is not important ...
     1987    SearchDirection.MakeNormalVector(&Chord, &Oben);  // whether we look "left" first or "right" first is not important ...
    19981988
    19991989    // adding point 1 and point 2 and add the line between them
     
    20031993    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
    20041994    CandidateForTesselation OptCandidates(&BaseLine);
    2005     FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC);
     1995    FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC);
    20061996    Log() << Verbose(0) << "List of third Points is:" << endl;
    20071997    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
     
    21772167  Vector CircleCenter;
    21782168  Vector CirclePlaneNormal;
    2179   Vector RelativeSphereCenter;
     2169  Vector OldSphereCenter;
    21802170  Vector SearchDirection;
    21812171  Vector helper;
     
    21842174  double radius, CircleRadius;
    21852175
     2176  Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl;
    21862177  for (int i=0;i<3;i++)
    2187     if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) {
     2178    if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node))
    21882179      ThirdNode = T.endpoints[i]->node;
    2189       break;
    2190     }
    2191   Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdNode " << *ThirdNode << " of triangle " << T << "." << endl;
    21922180
    21932181  // construct center of circle
     
    22032191  radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
    22042192  if (radius/4. < RADIUS*RADIUS) {
    2205     // construct relative sphere center with now known CircleCenter
    2206     RelativeSphereCenter.CopyVector(&T.SphereCenter);
    2207     RelativeSphereCenter.SubtractVector(&CircleCenter);
    2208 
    22092193    CircleRadius = RADIUS*RADIUS - radius/4.;
    22102194    CirclePlaneNormal.Normalize();
    22112195    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    22122196
    2213     Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl;
    2214 
    2215     // construct SearchDirection and an "outward pointer"
    2216     SearchDirection.MakeNormalVector(&RelativeSphereCenter, &CirclePlaneNormal);
    2217     helper.CopyVector(&CircleCenter);
     2197    // construct old center
     2198    GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node);
     2199    helper.CopyVector(&T.NormalVector);  // normal vector ensures that this is correct center of the two possible ones
     2200    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     2201    helper.Scale(sqrt(RADIUS*RADIUS - radius));
     2202    OldSphereCenter.AddVector(&helper);
     2203    OldSphereCenter.SubtractVector(&CircleCenter);
     2204    Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2205
     2206    // construct SearchDirection
     2207    SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal);
     2208    helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
    22182209    helper.SubtractVector(ThirdNode->node);
    22192210    if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    22202211      SearchDirection.Scale(-1.);
     2212    SearchDirection.ProjectOntoPlane(&OldSphereCenter);
     2213    SearchDirection.Normalize();
    22212214    Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    2222     if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
     2215    if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    22232216      // rotated the wrong way!
    22242217      eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     
    22262219
    22272220    // add third point
    2228     FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, ThirdNode, RADIUS, LC);
     2221    FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine, ThirdNode, RADIUS, LC);
    22292222
    22302223  } else {
     
    23572350    AddTesselationPoint((*Sprinter), 2);
    23582351
    2359 
     2352    Center.CopyVector(&CandidateLine.OptCenter);
    23602353    // add the lines
    23612354    AddTesselationLine(TPS[0], TPS[1], 0);
     
    23662359    BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    23672360    AddTesselationTriangle();
    2368     BTS->GetCenter(&Center);
    2369     Center.SubtractVector(&CandidateLine.OptCenter);
    2370     BTS->SphereCenter.CopyVector(&CandidateLine.OptCenter);
     2361    Center.Scale(-1.);
    23712362    BTS->GetNormalVector(Center);
    23722363
     
    27752766  Vector NewNormalVector;   // normal vector of the Candidate's triangle
    27762767  Vector helper, OptCandidateCenter, OtherOptCandidateCenter;
    2777   Vector RelativeOldSphereCenter;
    2778   Vector NewPlaneCenter;
    27792768  double CircleRadius; // radius of this circle
    27802769  double radius;
    2781   double otherradius;
    27822770  double alpha, Otheralpha; // angles (i.e. parameter for the circle).
    2783   bool IsDegenerated;
    27842771  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    27852772  TesselPoint *Candidate = NULL;
    2786   TesselPoint *CandidateTriangle[3];
    27872773
    27882774  Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     
    27972783  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    27982784
    2799   RelativeOldSphereCenter.CopyVector(&OldSphereCenter);
    2800   RelativeOldSphereCenter.SubtractVector(&CircleCenter);
    2801 
    2802   CandidateTriangle[0] = CandidateLine.BaseLine->endpoints[0]->node;
    2803   CandidateTriangle[1] = CandidateLine.BaseLine->endpoints[1]->node;
    2804 
    28052785  // calculate squared radius TesselPoint *ThirdNode,f circle
    2806   radius = CirclePlaneNormal.NormSquared()/4.;
    2807   if (radius < RADIUS*RADIUS) {
    2808     CircleRadius = RADIUS*RADIUS - radius;
     2786  radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
     2787  if (radius/4. < RADIUS*RADIUS) {
     2788    CircleRadius = RADIUS*RADIUS - radius/4.;
    28092789    CirclePlaneNormal.Normalize();
    2810     Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2790    //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    28112791
    28122792    // test whether old center is on the band's plane
    2813     if (fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    2814       eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
    2815       RelativeOldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
    2816     }
    2817     radius = RelativeOldSphereCenter.NormSquared();
     2793    if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
     2794      eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
     2795      OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
     2796    }
     2797    radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);
    28182798    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    2819       Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl;
     2799      //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    28202800
    28212801      // check SearchDirection
    2822       Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    2823       if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
     2802      //Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2803      if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    28242804        eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
    28252805      }
     
    28522832
    28532833                // check for three unique points
    2854                 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl;
     2834                Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << *(Candidate->node) << "." << endl;
    28552835                if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){
    28562836
    2857                   // find center on the plane
    2858                   GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
    2859                   Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;
     2837                  // construct both new centers
     2838                  GetCenterofCircumcircle(&NewSphereCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
     2839                  OtherNewSphereCenter.CopyVector(&NewSphereCenter);
    28602840
    28612841                  if ((NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node))
    2862                   && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON)
     2842                  && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON)
    28632843                  ) {
     2844                    helper.CopyVector(&NewNormalVector);
    28642845                    Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
    2865                     radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter);
    2866                     Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    2867                     Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    2868                     Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl;
     2846                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
    28692847                    if (radius < RADIUS*RADIUS) {
    2870                       otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);
    2871                       if (fabs(radius - otherradius) > HULLEPSILON) {
    2872                         eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl;
    2873                       }
    2874                       // construct both new centers
    2875                       NewSphereCenter.CopyVector(&NewPlaneCenter);
    2876                       OtherNewSphereCenter.CopyVector(&NewPlaneCenter);
    2877                       helper.CopyVector(&NewNormalVector);
    28782848                      helper.Scale(sqrt(RADIUS*RADIUS - radius));
    2879                       Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl;
     2849                      Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
    28802850                      NewSphereCenter.AddVector(&helper);
     2851                      NewSphereCenter.SubtractVector(&CircleCenter);
    28812852                      Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
     2853
    28822854                      // OtherNewSphereCenter is created by the same vector just in the other direction
    28832855                      helper.Scale(-1.);
    28842856                      OtherNewSphereCenter.AddVector(&helper);
     2857                      OtherNewSphereCenter.SubtractVector(&CircleCenter);
    28852858                      Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
    28862859
     
    28882861                      Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    28892862                      alpha = min(alpha, Otheralpha);
    2890 
    2891                       CandidateTriangle[2] = Candidate;
    2892                       // the idea of the IsDegenerated flag is not to put a penalty on degenerated triangles, but to push them to the
    2893                       // very end of the Tesselation::OpenLines list.
    2894                       IsDegenerated = (CheckPresenceOfTriangle(CandidateTriangle) >= 3);
    2895                       if (!IsDegenerated && CandidateLine.IsDegenerated) {  // if current is not, but old one was, comparison would be unfair
    2896                         // if there is a better candidate, drop the current list and add the new candidate
    2897                         // otherwise ignore the new candidate and keep the list
    2898                         if (CandidateLine.ShortestAngle-2.*M_PI > (alpha - HULLEPSILON)) {
    2899                           if (fabs(alpha - Otheralpha) > MYEPSILON) {
    2900                             CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
    2901                             CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    2902                           } else {
    2903                             CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
    2904                             CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    2905                           }
    2906                           // if there is an equal candidate, add it to the list without clearing the list
    2907                           if ((CandidateLine.ShortestAngle-2.*M_PI - HULLEPSILON) < alpha) {
    2908                             CandidateLine.pointlist.push_back(Candidate);
    2909                             Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
    2910                               << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    2911                           } else {
    2912                             // remove all candidates from the list and then the list itself
    2913                             CandidateLine.pointlist.clear();
    2914                             CandidateLine.pointlist.push_back(Candidate);
    2915                             Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
    2916                               << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    2917                           }
    2918                           CandidateLine.ShortestAngle = alpha;
    2919                           CandidateLine.IsDegenerated = IsDegenerated;
    2920                           if (IsDegenerated)
    2921                             CandidateLine.ShortestAngle += 2.*M_PI;
    2922                           Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
     2863                      // if there is a better candidate, drop the current list and add the new candidate
     2864                      // otherwise ignore the new candidate and keep the list
     2865                      if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
     2866                        if (fabs(alpha - Otheralpha) > MYEPSILON) {
     2867                          CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
     2868                          CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    29232869                        } else {
    2924                           if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
    2925                             Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    2926                           } else {
    2927                             Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    2928                           }
     2870                          CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
     2871                          CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    29292872                        }
     2873                        // if there is an equal candidate, add it to the list without clearing the list
     2874                        if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
     2875                          CandidateLine.pointlist.push_back(Candidate);
     2876                          Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
     2877                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
     2878                        } else {
     2879                          // remove all candidates from the list and then the list itself
     2880                          CandidateLine.pointlist.clear();
     2881                          CandidateLine.pointlist.push_back(Candidate);
     2882                          Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
     2883                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
     2884                        }
     2885                        CandidateLine.ShortestAngle = alpha;
     2886                        Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
    29302887                      } else {
    2931                         // if there is a better candidate, drop the current list and add the new candidate
    2932                         // otherwise ignore the new candidate and keep the list
    2933                         if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
    2934                           if (fabs(alpha - Otheralpha) > MYEPSILON) {
    2935                             CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
    2936                             CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    2937                           } else {
    2938                             CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
    2939                             CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    2940                           }
    2941                           // if there is an equal candidate, add it to the list without clearing the list
    2942                           if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
    2943                             CandidateLine.pointlist.push_back(Candidate);
    2944                             Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
    2945                               << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    2946                           } else {
    2947                             // remove all candidates from the list and then the list itself
    2948                             CandidateLine.pointlist.clear();
    2949                             CandidateLine.pointlist.push_back(Candidate);
    2950                             Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
    2951                               << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    2952                           }
    2953                           CandidateLine.ShortestAngle = alpha;
    2954                           Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
     2888                        if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
     2889                          Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    29552890                        } else {
    2956                           if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
    2957                             Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    2958                           } else {
    2959                             Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    2960                           }
     2891                          Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    29612892                        }
    29622893                      }
     
    41974128
    41984129  /// 2. Go through all BoundaryPointSet's, check their triangles' NormalVector
    4199   map <int, int> *DegeneratedTriangles = FindAllDegeneratedTriangles();
    42004130  set < BoundaryPointSet *> EndpointCandidateList;
    42014131  pair < set < BoundaryPointSet *>::iterator, bool > InsertionTester;
     
    42084138    for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++)
    42094139      for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) {
    4210         if (DegeneratedTriangles->find(TriangleRunner->second->Nr) == DegeneratedTriangles->end()) {
    4211           TriangleInsertionTester = TriangleVectors.insert( pair< int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)) );
    4212           if (TriangleInsertionTester.second)
    4213             Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;
    4214         } else {
    4215           Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl;
    4216         }
     4140        TriangleInsertionTester = TriangleVectors.insert( pair< int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)) );
     4141        if (TriangleInsertionTester.second)
     4142          Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;
    42174143      }
    42184144    // check whether there are two that are parallel
     
    42874213    /// 4a. Gather all triangles of this polygon
    42884214    TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints();
    4289 
    4290     if (T->size() == 2) {
    4291       Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;
    4292       delete(T);
    4293       continue;
    4294     }
    42954215
    42964216    TriangleSet::iterator TriangleWalker = T->begin();  // is the inner iterator
Note: See TracChangeset for help on using the changeset viewer.