Index: src/boundary.cpp
===================================================================
--- src/boundary.cpp	(revision 9a0dc86befb40ba6fad6508c1b54291296609a92)
+++ src/boundary.cpp	(revision f1ef60a25947d39dbd0f9b8ba6bdc7726c8b8b4f)
@@ -994,9 +994,10 @@
   while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
     if (baseline->second->triangles.size() == 1) {
+      CheckListOfBaselines(TesselStruct);
       // 3. find next triangle
       TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
       OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
       if (!TesselationFailFlag)
-        eLog() << Verbose(0) << "WARNING: FindNextSuitableTriangle failed." << endl;
+        eLog() << Verbose(2) << "FindNextSuitableTriangle failed." << endl;
 
       // write temporary envelope
@@ -1006,10 +1007,13 @@
         }
       }
-      baseline = TesselStruct->LinesOnBoundary.end();
-      Log() << Verbose(2) << "Baseline set to end." << endl;
+      if (TesselationFailFlag) {
+        baseline = TesselStruct->LinesOnBoundary.begin();
+        OneLoopWithoutSuccessFlag = false;
+        Log() << Verbose(2) << "Baseline set to begin." << endl;
+      }
     } else {
       //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
       if (baseline->second->triangles.size() != 2)
-        Log() << Verbose(1) << "ERROR: TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
+        eLog() << Verbose(1) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
     }
 
Index: src/boundary.hpp
===================================================================
--- src/boundary.hpp	(revision 9a0dc86befb40ba6fad6508c1b54291296609a92)
+++ src/boundary.hpp	(revision f1ef60a25947d39dbd0f9b8ba6bdc7726c8b8b4f)
@@ -35,5 +35,5 @@
 
 #define DEBUG 1
-#define DoSingleStepOutput 0
+#define DoSingleStepOutput 1
 #define SingleStepWidth 1
 
Index: src/tesselation.cpp
===================================================================
--- src/tesselation.cpp	(revision 9a0dc86befb40ba6fad6508c1b54291296609a92)
+++ src/tesselation.cpp	(revision f1ef60a25947d39dbd0f9b8ba6bdc7726c8b8b4f)
@@ -1244,4 +1244,18 @@
 ;
 
+/** Sets point to a present Tesselation::PointsOnBoundary.
+ * Tesselation::TPS is set to the existing one or NULL if not found.
+ * @param Candidate point to set to
+ * @param n index for this point in Tesselation::TPS array
+ */
+void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const
+{
+  PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr);
+  if (FindPoint != PointsOnBoundary.end())
+    TPS[n] = FindPoint->second;
+  else
+    TPS[n] = NULL;
+};
+
 /** Function tries to add line from current Points in BPS to BoundaryLineSet.
  * If successful it raises the line count and inserts the new line into the BLS,
@@ -1451,5 +1465,6 @@
  *                 triangles exist which is the maximum for three points
  */
-int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) {
+int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const
+{
   int adjacentTriangleCount = 0;
   class BoundaryPointSet *Points[3];
@@ -1458,5 +1473,5 @@
   // builds a triangle point set (Points) of the end points
   for (int i = 0; i < 3; i++) {
-    PointMap::iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);
+    PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);
     if (FindPoint != PointsOnBoundary.end()) {
       Points[i] = FindPoint->second;
@@ -1471,9 +1486,9 @@
       for (int j = i; j < 3; j++) {
         if (Points[j] != NULL) {
-          LineMap::iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);
+          LineMap::const_iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);
           for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
             TriangleMap *triangles = &FindLine->second->triangles;
             Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
-            for (TriangleMap::iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
+            for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
               if (FindTriangle->second->IsPresentTupel(Points)) {
                 adjacentTriangleCount++;
@@ -1700,4 +1715,147 @@
 };
 
+/** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates.
+ * This is supposed to prevent early closing of the tesselation.
+ * \param *BaseRay baseline, i.e. not \a *OptCandidate
+ * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints
+ * \param ShortestAngle path length on this circle band for the current \a *ThirdNode
+ * \param RADIUS radius of sphere
+ * \param *LC LinkedCell structure
+ * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found
+ */
+bool Tesselation::HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const ThirdNode, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const
+{
+  bool result = false;
+  Vector CircleCenter;
+  Vector CirclePlaneNormal;
+  Vector OldSphereCenter;
+  Vector SearchDirection;
+  Vector helper;
+  TesselPoint *OtherOptCandidate = NULL;
+  double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
+  double radius, CircleRadius;
+  BoundaryLineSet *Line = NULL;
+  BoundaryTriangleSet *T = NULL;
+
+  Log() << Verbose(1) << "Begin of HasOtherBaselineBetterCandidate" << endl;
+
+  // check both other lines
+  PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
+  if (FindPoint != PointsOnBoundary.end()) {
+    for (int i=0;i<2;i++) {
+      LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
+      if (FindLine != (FindPoint->second)->lines.end()) {
+        Line = FindLine->second;
+        Log() << Verbose(1) << "Found line " << *Line << "." << endl;
+        if (Line->triangles.size() == 1) {
+          T = Line->triangles.begin()->second;
+          // construct center of circle
+          CircleCenter.CopyVector(Line->endpoints[0]->node->node);
+          CircleCenter.AddVector(Line->endpoints[1]->node->node);
+          CircleCenter.Scale(0.5);
+
+          // construct normal vector of circle
+          CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
+          CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
+
+          // calculate squared radius of circle
+          radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
+          if (radius/4. < RADIUS*RADIUS) {
+            CircleRadius = RADIUS*RADIUS - radius/4.;
+            CirclePlaneNormal.Normalize();
+            //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
+
+            // construct old center
+            GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
+            helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
+            radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
+            helper.Scale(sqrt(RADIUS*RADIUS - radius));
+            OldSphereCenter.AddVector(&helper);
+            OldSphereCenter.SubtractVector(&CircleCenter);
+            //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
+
+            // construct SearchDirection
+            SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
+            helper.CopyVector(Line->endpoints[0]->node->node);
+            helper.SubtractVector(ThirdNode->node);
+            if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
+              SearchDirection.Scale(-1.);
+            SearchDirection.ProjectOntoPlane(&OldSphereCenter);
+            SearchDirection.Normalize();
+            Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
+            if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
+              // rotated the wrong way!
+              eLog() << Verbose(0) << "ERROR: SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
+            }
+
+            // add third point
+            CandidateList *OptCandidates = new CandidateList();
+            FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, Line, ThirdNode, OptCandidates, &OtherShortestAngle, RADIUS, LC);
+            for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
+              if (((*it)->point == BaseRay->endpoints[0]->node) || ((*it)->point == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
+                continue;
+              Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
+              << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
+              Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
+
+              // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
+              TesselPoint *PointCandidates[3];
+              PointCandidates[0] = (*it)->point;
+              PointCandidates[1] = BaseRay->endpoints[0]->node;
+              PointCandidates[2] = BaseRay->endpoints[1]->node;
+              bool check=false;
+              int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
+              // If there is no triangle, add it regularly.
+              if (existentTrianglesCount == 0) {
+                SetTesselationPoint((*it)->point, 0);
+                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
+                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
+
+                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
+                  OtherOptCandidate = (*it)->point;
+                  check = true;
+                }
+              } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
+                SetTesselationPoint((*it)->point, 0);
+                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
+                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
+
+                // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
+                // i.e. at least one of the three lines must be present with TriangleCount <= 1
+                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
+                  OtherOptCandidate = (*it)->point;
+                  check = true;
+                }
+              }
+
+              if (check) {
+                if (ShortestAngle > OtherShortestAngle) {
+                  Log() << Verbose(1) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
+                  result = true;
+                  break;
+                }
+              }
+            }
+            delete(OptCandidates);
+            if (result)
+              break;
+          } else {
+            Log() << Verbose(1) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
+          }
+        } else {
+          eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
+        }
+      } else {
+        Log() << Verbose(2) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
+      }
+    }
+  } else {
+    eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
+  }
+
+  Log() << Verbose(1) << "End of HasOtherBaselineBetterCandidate" << endl;
+
+  return result;
+};
 
 /** This function finds a triangle to a line, adjacent to an existing one.
@@ -1782,7 +1940,6 @@
   Log() << Verbose(1) << "Third Points are ";
   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
-    Log() << Verbose(0) << " " << *(*it)->point;
-  }
-  Log() << Verbose(0) << endl;
+    Log() << Verbose(1) << " " << *(*it)->point << endl;
+  }
 
   BoundaryLineSet *BaseRay = &Line;
@@ -1800,40 +1957,16 @@
 
     BTS = NULL;
-    // If there is no triangle, add it regularly.
-    if (existentTrianglesCount == 0) {
-      AddTesselationPoint((*it)->point, 0);
-      AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
-      AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
-
-      if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
-        AddTesselationLine(TPS[0], TPS[1], 0);
-        AddTesselationLine(TPS[0], TPS[2], 1);
-        AddTesselationLine(TPS[1], TPS[2], 2);
-
-        BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
-        AddTesselationTriangle();
-        (*it)->OptCenter.Scale(-1.);
-        BTS->GetNormalVector((*it)->OptCenter);
-        (*it)->OptCenter.Scale(-1.);
-
-        Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
-          << " for this triangle ... " << endl;
-      //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
-      } else {
-        Log() << Verbose(1) << "WARNING: This triangle consisting of ";
-        Log() << Verbose(0) << *(*it)->point << ", ";
-        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
-        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
-        Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
-        result = false;
-      }
-    } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
+    // check for present edges and whether we reach better candidates from them
+    if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
+      result = false;
+      break;
+    } else {
+      // If there is no triangle, add it regularly.
+      if (existentTrianglesCount == 0) {
         AddTesselationPoint((*it)->point, 0);
         AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
         AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
 
-        // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
-        // i.e. at least one of the three lines must be present with TriangleCount <= 1
-        if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
+        if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
           AddTesselationLine(TPS[0], TPS[1], 0);
           AddTesselationLine(TPS[0], TPS[2], 1);
@@ -1841,13 +1974,12 @@
 
           BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
-          AddTesselationTriangle();  // add to global map
-
-          (*it)->OtherOptCenter.Scale(-1.);
-          BTS->GetNormalVector((*it)->OtherOptCenter);
-          (*it)->OtherOptCenter.Scale(-1.);
-
-          Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector
-          << " for this triangle ... " << endl;
-          Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
+          AddTesselationTriangle();
+          (*it)->OptCenter.Scale(-1.);
+          BTS->GetNormalVector((*it)->OptCenter);
+          (*it)->OptCenter.Scale(-1.);
+
+          Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
+            << " for this triangle ... " << endl;
+        //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
         } else {
           Log() << Verbose(1) << "WARNING: This triangle consisting of ";
@@ -1858,11 +1990,42 @@
           result = false;
         }
-    } else {
-      Log() << Verbose(1) << "This triangle consisting of ";
-      Log() << Verbose(0) << *(*it)->point << ", ";
-      Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
-      Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
-      Log() << Verbose(0) << "is invalid!" << endl;
-      result = false;
+      } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
+          AddTesselationPoint((*it)->point, 0);
+          AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
+          AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
+
+          // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
+          // i.e. at least one of the three lines must be present with TriangleCount <= 1
+          if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
+            AddTesselationLine(TPS[0], TPS[1], 0);
+            AddTesselationLine(TPS[0], TPS[2], 1);
+            AddTesselationLine(TPS[1], TPS[2], 2);
+
+            BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
+            AddTesselationTriangle();  // add to global map
+
+            (*it)->OtherOptCenter.Scale(-1.);
+            BTS->GetNormalVector((*it)->OtherOptCenter);
+            (*it)->OtherOptCenter.Scale(-1.);
+
+            Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector
+            << " for this triangle ... " << endl;
+            Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
+          } else {
+            Log() << Verbose(1) << "WARNING: This triangle consisting of ";
+            Log() << Verbose(0) << *(*it)->point << ", ";
+            Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
+            Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
+            Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
+            result = false;
+          }
+      } else {
+        Log() << Verbose(1) << "This triangle consisting of ";
+        Log() << Verbose(0) << *(*it)->point << ", ";
+        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
+        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
+        Log() << Verbose(0) << "is invalid!" << endl;
+        result = false;
+      }
     }
 
@@ -2177,16 +2340,10 @@
   }
   // then go through the current and all neighbouring cells and check the contained points for possible candidates
-  Log() << Verbose(3) << "LC Intervals from [";
-  for (int i=0;i<NDIM;i++) {
-  Log() << Verbose(0) << " " << N[i] << "<->" << LC->N[i];
-  }
-  Log() << Verbose(0) << "] :";
   for (int i=0;i<NDIM;i++) {
     Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
     Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
-    Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";
-  }
-  Log() << Verbose(0) << endl;
-
+  }
+  Log() << Verbose(3) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
+    << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl;
 
   for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
@@ -2280,5 +2437,5 @@
  * @param *LC LinkedCell structure with neighbouring points
  */
-void Tesselation::FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint  *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC)
+void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint  * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const
 {
   Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
Index: src/tesselation.hpp
===================================================================
--- src/tesselation.hpp	(revision 9a0dc86befb40ba6fad6508c1b54291296609a92)
+++ src/tesselation.hpp	(revision f1ef60a25947d39dbd0f9b8ba6bdc7726c8b8b4f)
@@ -205,4 +205,5 @@
 
     void AddTesselationPoint(TesselPoint* Candidate, const int n);
+    void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
     void AddTesselationLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
@@ -217,7 +218,7 @@
     void FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
     void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
-    void FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC);
+    void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const;
     bool FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
-    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]);
+    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
     class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
 
@@ -281,7 +282,9 @@
 
   private:
-    class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
+    mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
 
     mutable PointMap::const_iterator InternalPointer;
+
+    bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
 };
 
Index: src/tesselationhelpers.cpp
===================================================================
--- src/tesselationhelpers.cpp	(revision 9a0dc86befb40ba6fad6508c1b54291296609a92)
+++ src/tesselationhelpers.cpp	(revision f1ef60a25947d39dbd0f9b8ba6bdc7726c8b8b4f)
@@ -461,5 +461,8 @@
   for (int i=0;i<3;i++)
     for (int j=i+1; j<3; j++) {
-      if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) {  // there already is a line
+      if (nodes[i] == NULL) {
+        Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl;
+        result = true;
+      } else if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) {  // there already is a line
         LineMap::const_iterator FindLine;
         pair<LineMap::const_iterator,LineMap::const_iterator> FindPair;
