diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp
index a93934302775da79b54077e44de3543cc2e4f31d..ae46c4e480d0aa21eff3a21281a1c4f34579232f 100644
--- a/Geo/GEdge.cpp
+++ b/Geo/GEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: GEdge.cpp,v 1.44 2008-02-23 15:40:29 geuzaine Exp $
+// $Id: GEdge.cpp,v 1.45 2008-02-23 16:19:22 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -73,6 +73,7 @@ void GEdge::resetMeshAttributes()
   meshAttributes.typeTransfinite = 0;
   meshAttributes.extrude = 0;
   meshAttributes.meshSize = 1.e22;
+  meshAttributes.minimumMeshSegments = 1;
 }
 
 void GEdge::addFace(GFace *e)
diff --git a/Geo/GEdge.h b/Geo/GEdge.h
index 869d828824b2e4ae971cd40b530618b9020f9e68..a44d5504cf9ad440b95f7c145bdd08f139758a02 100644
--- a/Geo/GEdge.h
+++ b/Geo/GEdge.h
@@ -124,6 +124,7 @@ class GEdge : public GEntity {
     double meshSize;
     int    nbPointsTransfinite;
     int    typeTransfinite;
+    int   minimumMeshSegments;
     // the extrusion parameters (if any)
     ExtrudeParams *extrude;
   } meshAttributes ;
diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp
index a5083fb13bfaae56d04e1aa8052e9c820cf2492d..c5354020fc799b444d02c97b87d4b38e6a1b1bdb 100644
--- a/Geo/OCCEdge.cpp
+++ b/Geo/OCCEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCEdge.cpp,v 1.34 2008-02-17 09:30:28 geuzaine Exp $
+// $Id: OCCEdge.cpp,v 1.35 2008-02-23 16:19:22 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -210,7 +210,7 @@ int OCCEdge::minimumMeshSegments() const
   // 1D mesh (4 segments, one of which is degenerated)
   if (getBeginVertex() == getEndVertex()) np = std::max(4, np);
 
-  return np;
+  return std::max(np,meshAttributes.minimumMeshSegments);
 }
 
 int OCCEdge::minimumDrawSegments() const
diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp
index b34cadde525b645ae526c116f385a12849074ca9..bb6d3d9a6482d0ce8684ef7b07c413f1ca2d8b56 100644
--- a/Geo/OCCFace.cpp
+++ b/Geo/OCCFace.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCFace.cpp,v 1.37 2008-02-22 21:09:00 geuzaine Exp $
+// $Id: OCCFace.cpp,v 1.38 2008-02-23 16:19:22 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -65,11 +65,19 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
     }      
     
     //    GEdgeLoop el(l_wire,l_oris);
-    GEdgeLoop el(l_wire);
-    
+    GEdgeLoop el(l_wire);        
+
     for(GEdgeLoop::citer it = el.begin() ; it != el.end() ; ++it){
       l_edges.push_back(it->ge);
       l_dirs.push_back(it->_sign);
+      if (el.count() == 2){
+	it->ge->meshAttributes.minimumMeshSegments = 
+	  std::max(it->ge->meshAttributes.minimumMeshSegments,2);
+      }
+      if (el.count() == 1){
+	it->ge->meshAttributes.minimumMeshSegments = 
+	  std::max(it->ge->meshAttributes.minimumMeshSegments,3);
+      }
     }
     
     edgeLoops.push_back(el);
diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp
index eb3d2115b8dcf3b54f8057db273bea27c318f87f..9b1b21a347ec5304a1e9f295ff571c69bd1f2472 100644
--- a/Geo/gmshEdge.cpp
+++ b/Geo/gmshEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshEdge.cpp,v 1.45 2008-02-17 09:30:28 geuzaine Exp $
+// $Id: gmshEdge.cpp,v 1.46 2008-02-23 16:21:51 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -106,13 +106,15 @@ GEntity::GeomType gmshEdge::geomType() const
 
 int gmshEdge::minimumMeshSegments () const
 {
+  int np;
   if(geomType() == Line)
-    return GEdge::minimumMeshSegments();
+    np = GEdge::minimumMeshSegments();
   else if(geomType() == Circle || geomType() == Ellipse)
-    return (int)(fabs(c->Circle.t1 - c->Circle.t2) *
+    np = (int)(fabs(c->Circle.t1 - c->Circle.t2) *
 		 (double)CTX.mesh.min_circ_points / Pi) - 1;
   else
-    return CTX.mesh.min_curv_points - 1;
+    np = CTX.mesh.min_curv_points - 1;
+  return std::max(np,meshAttributes.minimumMeshSegments);
 }
 
 int gmshEdge::minimumDrawSegments () const
diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp
index 9b610518eb1018ece3b8f1f3b1cfb137017f63e8..3027b811ae6eff52d7eb5c29bfe7bf9b3d3870e4 100644
--- a/Geo/gmshFace.cpp
+++ b/Geo/gmshFace.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshFace.cpp,v 1.50 2008-02-22 21:09:00 geuzaine Exp $
+// $Id: gmshFace.cpp,v 1.51 2008-02-23 16:19:22 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -33,10 +33,15 @@ gmshFace::gmshFace(GModel *m, Surface *face)
     Curve *c;
     List_Read(s->Generatrices, i, &c);
     GEdge *e = m->getEdgeByTag(abs(c->Num));
+
     if(e){
       l_edges.push_back(e);
       e->addFace(this);
       l_dirs.push_back((c->Num > 0) ? 1 : -1);
+      if (List_Nbr(s->Generatrices) == 2){
+	e->meshAttributes.minimumMeshSegments = 
+	  std::max(e->meshAttributes.minimumMeshSegments,2);
+      }
     }
     else
       Msg(GERROR, "Unknown curve %d", c->Num);
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 0e0f158b59bcfded8fb34e684e646cd6c01b3304..709cfb91d4e9a46dc7d5be71034336a2d997c32b 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.121 2008-02-23 15:30:07 geuzaine Exp $
+// $Id: meshGFace.cpp,v 1.122 2008-02-23 16:19:22 remacle Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -446,6 +446,13 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
     doc.points[all_vertices.size() + ip].data = bb[ip];
   }
 
+  // if the number of vertices is less or equal to 2, then no elements are generated
+  if (all_vertices.size() <= 2){
+    free(doc.points);
+    free(doc.delaunay);
+    for(int ip = 0; ip < 4; ip++) delete bb[ip];
+  }
+
   // Use "fast" inhouse recursive algo to generate the triangulation
   // At this stage the triangulation is not what we need
   //   -) It does not necessary recover the boundaries