From 4cca60e22972cd8596eef25cf2f24ccdd1093402 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 23 Oct 2015 11:59:23 +0000
Subject: [PATCH] fix clpy mesh for parameter ranges != [0,1]

---
 Mesh/meshGEdge.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp
index a4ff906275..9feda8d551 100644
--- a/Mesh/meshGEdge.cpp
+++ b/Mesh/meshGEdge.cpp
@@ -273,11 +273,15 @@ void copyMesh(GEdge *from, GEdge *to, int direction)
   double u_min = u_bounds.low();
   double u_max = u_bounds.high();
 
+  Range<double> to_u_bounds = to->parBounds(0);
+  double to_u_min = to_u_bounds.low();
+  double to_u_max = to_u_bounds.high();
+
   for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){
     int index = (direction < 0) ? (from->mesh_vertices.size() - 1 - i) : i;
     MVertex *v = from->mesh_vertices[index];
     double u; v->getParameter(0, u);
-    double newu = (direction > 0) ? u : (u_max - u + u_min);
+    double newu = (direction > 0) ? (u-u_min+to_u_min) : (u_max-u+to_u_min);
     GPoint gp = to->point(newu);
     MEdgeVertex *vv = new MEdgeVertex(gp.x(), gp.y(), gp.z(), to, newu);
     to->mesh_vertices.push_back(vv);
-- 
GitLab