From 2f9a0da21f357e41b16dbfb5c540034a5f2ecea3 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 27 Aug 2007 19:52:07 +0000
Subject: [PATCH] *** empty log message ***

---
 Geo/Geo.cpp | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 5e88303aa5..81f556e365 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Geo.cpp,v 1.91 2007-08-27 19:27:02 geuzaine Exp $
+// $Id: Geo.cpp,v 1.92 2007-08-27 19:52:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -2904,23 +2904,21 @@ void Projette(Vertex *v, double mat[3][3])
 
 static void intersectCS(int N, double x[], double res[])
 {
-  //x[1] = u x[2] = v x[3] = w
-  Vertex s, c;
-  s = InterpolateSurface(SURFACE, x[1], x[2], 0, 0);
-  c = InterpolateCurve(CURVE, x[3], 0);
+  // (x[1], x[2]) = surface params, x[3] = curve param
+  Vertex s = InterpolateSurface(SURFACE, x[1], x[2], 0, 0);
+  Vertex c = InterpolateCurve(CURVE, x[3], 0);
   res[1] = s.Pos.X - c.Pos.X;
   res[2] = s.Pos.Y - c.Pos.Y;
   res[3] = s.Pos.Z - c.Pos.Z;
 }
 
-bool IntersectCurveSurface(Curve *c, Surface *s, double x[])
+bool IntersectCurveSurface(Curve *c, Surface *s, double x[4])
 {
   int check;
   SURFACE = s;
   CURVE = c;
   newt(x, 3, &check, intersectCS);
-  if(check)
-    return false;
+  if(check) return false;
   return true;
 }
 
@@ -2935,10 +2933,7 @@ bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *point
     double curve_id;
     List_Read(curve_ids, i, &curve_id);
     Curve *c = FindCurve((int)curve_id);
-    if(!c){
-      Msg(GERROR, "Uknown curve %d", (int)curve_id);
-    }
-    else{
+    if(c){
       double x[4] = {0., 0.5, 0.5, 0.5};
       if(IntersectCurveSurface(c, s, x)){
 	Vertex p = InterpolateCurve(c, x[3], 0);
@@ -2948,6 +2943,8 @@ bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *point
 	List_Add(point_ids, &num);
       }
     }
+    else
+      Msg(GERROR, "Uknown curve %d", (int)curve_id);
   }
 }
 
-- 
GitLab