Index: src/Tesselation/tesselation.cpp
===================================================================
--- src/Tesselation/tesselation.cpp	(revision d33bb8a2c2523a42b0a9e36768e551c57c340cbc)
+++ src/Tesselation/tesselation.cpp	(revision 32d7e4e99ad240050c6936e8be2d5450c409f996)
@@ -1902,19 +1902,24 @@
   class BoundaryLineSet *OldLines[4], *NewLine;
   class BoundaryPointSet *OldPoints[2];
-  Vector BaseLineNormal;
+  Vector BaseLineNormal[2];
+  Vector OtherEndpoint[2]; // fourth point to either triangle
   int OldTriangleNrs[2], OldBaseLineNr;
   int i, m;
 
   // calculate NormalVector for later use
-  BaseLineNormal.Zero();
   if (Base->triangles.size() < 2) {
     ELOG(1, "Less than two triangles are attached to this baseline!");
     return NULL;
   }
-  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
-    LOG(5, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << ".");
-    BaseLineNormal += (runner->second->NormalVector);
-  }
-  BaseLineNormal.Scale(-1. / 2.); // has to point inside for BoundaryTriangleSet::GetNormalVector()
+  {
+    int i=0;
+    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
+      LOG(5, "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << ".");
+      OtherEndpoint[(i+1)%2] = runner->second->GetThirdEndpoint(Base)->node->getPosition();
+      BaseLineNormal[i++] = (runner->second->NormalVector);
+      ASSERT( i <= 2,
+          "Tesselation::FlipBaseline() - not exactly two triangles found.");
+    }
+  }
 
   // get the two triangles
@@ -1946,4 +1951,6 @@
 
   // index OldLines and OldPoints
+  // note that oldlines[0,1] belong to first triangle and hence first normal
+  // vector and oldlines[2,3] belong to second triangle and its normal vector
   for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
     for (int j = 0; j < 3; j++) // all of their endpoints and baselines
@@ -1955,4 +1962,12 @@
         OldPoints[m++] = runner->second->endpoints[j];
 
+  Vector BasePoints[2]; // endpoints of Base
+  if (OldLines[0]->ContainsBoundaryPoint(Base->endpoints[0])) {
+    BasePoints[0] = Base->endpoints[0]->node->getPosition();
+    BasePoints[1] = Base->endpoints[1]->node->getPosition();
+  } else {
+    BasePoints[0] = Base->endpoints[1]->node->getPosition();
+    BasePoints[1] = Base->endpoints[0]->node->getPosition();
+  }
   // check whether everything is in place to create new lines and triangles
   if (i < 4) {
@@ -1970,4 +1985,9 @@
       return NULL;
     }
+
+  // construct plane of first triangle for calculating normal vectors later
+  const Plane triangleplane = Base->triangles.begin()->second->getPlane();
+  // get fourth point projected down onto this plane
+  const Vector Intersection = triangleplane.getClosestPoint(OtherEndpoint[0]);
 
   // remove triangles and baseline removes itself
@@ -1994,4 +2014,10 @@
   LOG(3, "DEBUG: Created new baseline " << *NewLine << ".");
 
+  // Explanation for normal vector choice:
+  // Decisive for the normal vector of the new triangle is whether the fourth
+  // endpoint is with respect to the joining boundary line on one side or on
+  // the other with respect to the endpoint of the plane triangle that is not
+  // contained in the joining boundary line.
+
   // construct new triangles with flipped baseline
   i = -1;
@@ -2005,5 +2031,24 @@
     BLS[2] = NewLine;
     BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[0]);
-    BTS->GetNormalVector(BaseLineNormal);
+    {
+      Line joiningline = makeLineThrough(
+          OldLines[0]->endpoints[0]->node->getPosition(),
+          OldLines[0]->endpoints[1]->node->getPosition());
+      // BasePoints[1] is not contained in OldLines[0], hence is third endpoint
+      // of plane triangle. BasePoints[0] is in the joining OldLines[0] and
+      // we check whether Intersection is on same side as BasePoints[1] or not.
+      const Vector pointinginside =
+          joiningline.getClosestPoint(BasePoints[1]) - BasePoints[1];
+      const Vector pointingtointersection =
+          joiningline.getClosestPoint(Intersection) - Intersection;
+      const double sign_of_intersection =
+          pointingtointersection.ScalarProduct(pointinginside);
+      LOG(4, "DEBUG: Sign of SKP between both lines w.r.t " << *OldLines[0]
+          << " is " << sign_of_intersection << ".");
+      const double sign_of_normal = (sign_of_intersection >= 0) ? -1. : +1.;
+      LOG(4, "DEBUG: Opposite normal direction is "
+          << sign_of_normal * BaseLineNormal[0] << ".");
+      BTS->GetNormalVector(sign_of_normal * BaseLineNormal[0]);
+    }
     AddTesselationTriangle(OldTriangleNrs[0]);
     LOG(3, "DEBUG: Created new triangle " << *BTS << ".");
@@ -2013,5 +2058,24 @@
     BLS[2] = NewLine;
     BTS = new class BoundaryTriangleSet(BLS, OldTriangleNrs[1]);
-    BTS->GetNormalVector(BaseLineNormal);
+    {
+      Line joiningline = makeLineThrough(
+          OldLines[1]->endpoints[0]->node->getPosition(),
+          OldLines[1]->endpoints[1]->node->getPosition());
+      // BasePoints[0] is not contained in OldLines[1], hence is third endpoint
+      // of plane triangle. BasePoints[1] is in th1e joining OldLines[1] and
+      // we check whether Intersection is on same side as BasePoints[0] or not.
+      const Vector pointinginside =
+          joiningline.getClosestPoint(BasePoints[0]) - BasePoints[0];
+      const Vector pointingtointersection =
+          joiningline.getClosestPoint(Intersection) - Intersection;
+      const double sign_of_intersection =
+          pointingtointersection.ScalarProduct(pointinginside);
+      LOG(4, "DEBUG: Sign of SKP between both lines w.r.t " << *OldLines[1]
+          << " is " << sign_of_intersection << ".");
+      const double sign_of_normal = (sign_of_intersection >= 0) ? -1. : +1.;
+      LOG(4, "DEBUG: Opposite normal direction is "
+          << sign_of_normal * BaseLineNormal[0] << ".");
+      BTS->GetNormalVector(sign_of_normal * BaseLineNormal[0]);
+    }
     AddTesselationTriangle(OldTriangleNrs[1]);
     LOG(3, "DEBUG: Created new triangle " << *BTS << ".");
