Index: src/boundary.cpp
===================================================================
--- src/boundary.cpp	(revision 791138754ff7351a49e1250e959a2ba16ccf9e8b)
+++ src/boundary.cpp	(revision 1e168baa79ecbcebe88b8d261ed41d6928a43ce9)
@@ -955,7 +955,7 @@
 {
   bool freeLC = false;
-  LineMap::iterator baseline;
+  CandidateForTesselation *baseline;
   LineMap::iterator testline;
-  bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
+  bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
   bool TesselationFailFlag = false;
 
@@ -982,39 +982,43 @@
 
   // 2. expand from there
-  baseline = TesselStruct->LinesOnBoundary.begin();
-  baseline++; // skip first line
-  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(2) << "FindNextSuitableTriangle failed." << endl;
-
-      // write temporary envelope
-      if (filename != NULL) {
-        if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
-          TesselStruct->Output(filename, mol);
-        }
+  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
+    // 2a. fill all new OpenLines
+    Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
+    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
+      Log() << Verbose(1) << *(Runner->second) << endl;
+
+    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
+      baseline = Runner->second;
+      if (baseline->point == NULL) {
+        Log() << Verbose(0) << "Finding best candidate for open line " << *baseline->BaseLine << endl;
+        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *(((baseline->BaseLine->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
       }
-      if (TesselationFailFlag) {
-        baseline = TesselStruct->LinesOnBoundary.begin();
-        OneLoopWithoutSuccessFlag = false;
-        Log() << Verbose(2) << "Baseline set to begin." << endl;
+    }
+
+    // 2b. search for smallest ShortestAngle among all candidates
+    double ShortestAngle = 4.*M_PI;
+    Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
+    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
+      Log() << Verbose(1) << *(Runner->second) << endl;
+
+    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
+      if (Runner->second->ShortestAngle < ShortestAngle) {
+        baseline = Runner->second;
+        ShortestAngle = baseline->ShortestAngle;
+        //Log() << Verbose(0) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
       }
-    } else {
-      //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
-      if (baseline->second->triangles.size() != 2) {
-        eLog() << Verbose(0) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
-        performCriticalExit();
+    }
+    if ((ShortestAngle == 4.*M_PI) || (baseline->point == NULL))
+      OneLoopWithoutSuccessFlag = false;
+    else {
+      TesselStruct->AddCandidateTriangle(*baseline);
+    }
+
+    // write temporary envelope
+    if (filename != NULL) {
+      if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
+        TesselStruct->Output(filename, mol);
       }
     }
-
-    if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
-      baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
-      OneLoopWithoutSuccessFlag = false;
-    }
-    baseline++;
   }
   // check envelope for consistency
Index: src/tesselation.cpp
===================================================================
--- src/tesselation.cpp	(revision 791138754ff7351a49e1250e959a2ba16ccf9e8b)
+++ src/tesselation.cpp	(revision 1e168baa79ecbcebe88b8d261ed41d6928a43ce9)
@@ -22,9 +22,9 @@
 /** Constructor of BoundaryPointSet.
  */
-BoundaryPointSet::BoundaryPointSet()
-{
-  LinesCount = 0;
-  Nr = -1;
-  value = 0.;
+BoundaryPointSet::BoundaryPointSet() :
+    LinesCount(0),
+    value(0.),
+    Nr(-1)
+{
 };
 
@@ -85,9 +85,9 @@
 /** Constructor of BoundaryLineSet.
  */
-BoundaryLineSet::BoundaryLineSet()
+BoundaryLineSet::BoundaryLineSet() :
+    Nr(-1)
 {
   for (int i = 0; i < 2; i++)
     endpoints[i] = NULL;
-  Nr = -1;
 };
 
@@ -106,4 +106,6 @@
   Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
   Point[1]->AddLine(this); //
+  // set skipped to false
+  skipped = false;
   // clear triangles list
   Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
@@ -286,5 +288,6 @@
 /** Constructor for BoundaryTriangleSet.
  */
-BoundaryTriangleSet::BoundaryTriangleSet()
+BoundaryTriangleSet::BoundaryTriangleSet() :
+  Nr(-1)
 {
   for (int i = 0; i < 3; i++)
@@ -293,5 +296,4 @@
       lines[i] = NULL;
     }
-  Nr = -1;
 };
 
@@ -300,10 +302,10 @@
  * \param number number of triangle
  */
-BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number)
+BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) :
+  Nr(number)
 {
   // set number
-  Nr = number;
   // set lines
-  Log() << Verbose(5) << "New triangle " << Nr << ":" << endl;
+  Log() << Verbose(5) << "New triangle " << Nr << ":";
   for (int i = 0; i < 3; i++)
     {
@@ -579,5 +581,4 @@
 PointCloud::PointCloud()
 {
-
 };
 
@@ -586,5 +587,4 @@
 PointCloud::~PointCloud()
 {
-
 };
 
@@ -593,7 +593,21 @@
 /** Constructor of class CandidateForTesselation.
  */
-CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) {
-  point = candidate;
-  BaseLine = line;
+CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) :
+  point(NULL),
+  BaseLine(line),
+  ShortestAngle(2.*M_PI),
+  OtherShortestAngle(2.*M_PI)
+{
+};
+
+
+/** Constructor of class CandidateForTesselation.
+ */
+CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
+    point(candidate),
+    BaseLine(line),
+    ShortestAngle(2.*M_PI),
+    OtherShortestAngle(2.*M_PI)
+{
   OptCenter.CopyVector(&OptCandidateCenter);
   OtherOptCenter.CopyVector(&OtherOptCandidateCenter);
@@ -607,16 +621,32 @@
 };
 
+/** output operator for CandidateForTesselation.
+ * \param &ost output stream
+ * \param &a boundary line
+ */
+ostream & operator <<(ostream &ost, const  CandidateForTesselation &a)
+{
+  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";
+  if (a.point == NULL)
+    ost << "no candidate.";
+  else
+    ost << "candidate " << *(a.point) << " at angle " << (a.ShortestAngle)<< ".";
+
+  return ost;
+};
+
+
 // =========================================================== class TESSELATION ===========================================
 
 /** Constructor of class Tesselation.
  */
-Tesselation::Tesselation()
-{
-  PointsOnBoundaryCount = 0;
-  LinesOnBoundaryCount = 0;
-  TrianglesOnBoundaryCount = 0;
-  InternalPointer = PointsOnBoundary.begin();
-  LastTriangle = NULL;
-  TriangleFilesWritten = 0;
+Tesselation::Tesselation() :
+  PointsOnBoundaryCount(0),
+  LinesOnBoundaryCount(0),
+  TrianglesOnBoundaryCount(0),
+  LastTriangle(NULL),
+  TriangleFilesWritten(0),
+  InternalPointer(PointsOnBoundary.begin())
+{
 }
 ;
@@ -1283,4 +1313,9 @@
         BLS[n] = FindLine->second;
 
+        // remove existing line from OpenLines
+        CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]);
+        delete(CandidateLine->second);
+        OpenLines.erase(CandidateLine);
+
         break;
       }
@@ -1304,5 +1339,5 @@
 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n)
 {
-  Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
+  Log() << Verbose(4) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
   BPS[0] = a;
   BPS[1] = b;
@@ -1312,4 +1347,7 @@
   // increase counter
   LinesOnBoundaryCount++;
+  // also add to open lines
+  CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]);
+  OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT));
 };
 
@@ -1680,13 +1718,13 @@
       << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n";
 
-      // if we do not reach the end with the next step of iteration, we need to setup a new first line
-      if (it != OptCandidates->end()--) {
-        FirstPoint = (*it)->BaseLine->endpoints[0]->node;
-        SecondPoint = (*it)->point;
-        // adding point 1 and point 2 and the line between them
-        AddTesselationPoint(FirstPoint, 0);
-        AddTesselationPoint(SecondPoint, 1);
-        AddTesselationLine(TPS[0], TPS[1], 0);
-      }
+//      // if we do not reach the end with the next step of iteration, we need to setup a new first line
+//      if (it != OptCandidates->end()--) {
+//        FirstPoint = (*it)->BaseLine->endpoints[0]->node;
+//        SecondPoint = (*it)->point;
+//        // adding point 1 and point 2 and the line between them
+//        AddTesselationPoint(FirstPoint, 0);
+//        AddTesselationPoint(SecondPoint, 1);
+//        AddTesselationLine(TPS[0], TPS[1], 0);
+//      }
       Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
     }
@@ -1860,5 +1898,5 @@
 /** This function finds a triangle to a line, adjacent to an existing one.
  * @param out output stream for debugging
- * @param Line current baseline to search from
+ * @param CandidateLine current cadndiate baseline to search from
  * @param T current triangle which \a Line is edge of
  * @param RADIUS radius of the rolling ball
@@ -1866,5 +1904,5 @@
  * @param *LC LinkedCell structure with neighbouring points
  */
-bool Tesselation::FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
+bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
 {
   Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
@@ -1882,17 +1920,17 @@
   double radius, CircleRadius;
 
-  Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;
+  Log() << Verbose(1) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl;
   for (int i=0;i<3;i++)
-    if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))
+    if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node))
       ThirdNode = T.endpoints[i]->node;
 
   // construct center of circle
-  CircleCenter.CopyVector(Line.endpoints[0]->node->node);
-  CircleCenter.AddVector(Line.endpoints[1]->node->node);
+  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
+  CircleCenter.AddVector(CandidateLine.BaseLine->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);
+  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
+  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
 
   // calculate squared radius of circle
@@ -1906,5 +1944,5 @@
     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);
+    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     helper.Scale(sqrt(RADIUS*RADIUS - radius));
     OldSphereCenter.AddVector(&helper);
@@ -1914,5 +1952,5 @@
     // construct SearchDirection
     SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal);
-    helper.CopyVector(Line.endpoints[0]->node->node);
+    helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     helper.SubtractVector(ThirdNode->node);
     if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
@@ -1927,8 +1965,8 @@
 
     // add third point
-    FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);
+    FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine.BaseLine, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);
 
   } else {
-    Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;
+    Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
   }
 
@@ -1942,5 +1980,5 @@
   }
 
-  BoundaryLineSet *BaseRay = &Line;
+  BoundaryLineSet *BaseRay = CandidateLine.BaseLine;
   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
@@ -1969,23 +2007,14 @@
 
         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;
+          CandidateLine.point = (*it)->point;
+          CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter));
+          CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter));
+          CandidateLine.ShortestAngle = ShortestAngle;
         } else {
-          eLog() << Verbose(2) << "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;
+//          eLog() << Verbose(2) << "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 0x80000000006fc150(does not seem helpful!" << endl;
           result = false;
         }
@@ -1997,28 +2026,20 @@
           // 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.);
-
-            eLog() << Verbose(2) << "--> 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;
+          if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) {
+            CandidateLine.point = (*it)->point;
+            CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter);
+            CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter);
+            CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI;
+
           } else {
-            eLog() << Verbose(2) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl;
+//            eLog() << Verbose(2) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "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;
+//        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;
       }
@@ -2043,4 +2064,31 @@
   Log() << Verbose(0) << "End of FindNextSuitableTriangle\n";
   return result;
+};
+
+/** Adds the present line and candidate point from \a &CandidateLine to the Tesselation.
+ * \param &CandidateLine triangle to add
+ */
+void Tesselation::AddCandidateTriangle(CandidateForTesselation &CandidateLine)
+{
+  Vector Center;
+  Log() << Verbose(2) << "BaseLine is :" << *(CandidateLine.BaseLine) << " with candidate " << *(CandidateLine.point) << "." << endl;
+  // add the points
+  AddTesselationPoint(CandidateLine.point, 0);
+  AddTesselationPoint(CandidateLine.BaseLine->endpoints[0]->node, 1);
+  AddTesselationPoint(CandidateLine.BaseLine->endpoints[1]->node, 2);
+
+  Center.CopyVector(&CandidateLine.OptCenter);
+  // add the lines
+  AddTesselationLine(TPS[0], TPS[1], 0);
+  AddTesselationLine(TPS[0], TPS[2], 1);
+  AddTesselationLine(TPS[1], TPS[2], 2);
+
+  // add the triangles
+  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
+  AddTesselationTriangle();
+  Center.Scale(-1.);
+  BTS->GetNormalVector(Center);
+
+  Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl;
 };
 
Index: src/tesselation.hpp
===================================================================
--- src/tesselation.hpp	(revision 791138754ff7351a49e1250e959a2ba16ccf9e8b)
+++ src/tesselation.hpp	(revision 1e168baa79ecbcebe88b8d261ed41d6928a43ce9)
@@ -53,4 +53,5 @@
 #define PointTestPair pair < PointMap::iterator, bool >
 #define CandidateList list <class CandidateForTesselation *>
+#define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
 
 #define LineMap multimap < int, class BoundaryLineSet * >
@@ -114,4 +115,5 @@
     TriangleMap triangles;
     int Nr;
+    bool skipped;
 };
 
@@ -186,4 +188,5 @@
 class CandidateForTesselation {
   public :
+  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
   CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
   ~CandidateForTesselation();
@@ -193,5 +196,9 @@
   Vector OptCenter;
   Vector OtherOptCenter;
-};
+  double ShortestAngle;
+  double OtherShortestAngle;
+};
+
+ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
 
 // =========================================================== class TESSELATION ===========================================
@@ -211,4 +218,5 @@
     void AddTesselationTriangle();
     void AddTesselationTriangle(const int nr);
+    void AddCandidateTriangle(CandidateForTesselation &CandidateLine);
     void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
     void RemoveTesselationLine(class BoundaryLineSet *line);
@@ -220,5 +228,5 @@
     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, 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);
+    bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
     int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
     class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
@@ -260,4 +268,5 @@
     PointMap PointsOnBoundary;
     LineMap LinesOnBoundary;
+    CandidateMap OpenLines;
     TriangleMap TrianglesOnBoundary;
     int PointsOnBoundaryCount;
