From 9eea74ac0de4c2ee9a28e9214ed7b53f2e4e5710 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 12 Feb 2009 18:22:00 +0000
Subject: [PATCH] don't store plane info in old struct since we cannot use it

---
 Geo/Geo.cpp              |  7 ------
 Geo/Geo.h                |  2 --
 Geo/GeoInterpolation.cpp | 53 ++++++++++------------------------------
 Geo/gmshFace.cpp         | 17 +++----------
 4 files changed, 17 insertions(+), 62 deletions(-)

diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index e16e6a53e7..ff2e65047e 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -913,13 +913,6 @@ static void CopySurface(Surface *s, Surface *ss)
   //ss->Method = s->Method;
   //ss->Recombine = s->Recombine;
   //ss->RecombineAngle = s->RecombineAngle;
-  ss->a = s->a;
-  ss->b = s->b;
-  ss->c = s->c;
-  ss->d = s->d;
-  for(i = 0; i < 3; i++)
-    for(j = 0; j < 3; j++)
-      ss->plan[i][j] = s->plan[i][j];
   ss->Generatrices = List_Create(List_Nbr(s->Generatrices), 1, sizeof(Curve *));
   List_Copy(s->Generatrices, ss->Generatrices);
   End_Surface(ss);
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 5572a6d795..c2500db20c 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -147,8 +147,6 @@ typedef struct{
   List_T *EmbeddedPoints;
   List_T *TrsfPoints;
   List_T *InSphereCenter;
-  double plan[3][3];
-  double a, b, c, d;
   ExtrudeParams *Extrude;
   DrawingColor Color;
   // A surface is defined topologically by its Generatrices
diff --git a/Geo/GeoInterpolation.cpp b/Geo/GeoInterpolation.cpp
index 3205e13325..46f746226e 100644
--- a/Geo/GeoInterpolation.cpp
+++ b/Geo/GeoInterpolation.cpp
@@ -11,8 +11,6 @@
 
 #define SQU(a)      ((a)*(a))
 
-// Curves
-
 static Vertex InterpolateCubicSpline(Vertex *v[4], double t, double mat[4][4],
 				     int derivee, double t1, double t2)
 {
@@ -379,8 +377,6 @@ Vertex InterpolateCurve(Curve *c, double u, int derivee)
 
 }
 
-// Surfaces
-
 // Interpolation transfinie sur un quadrangle :
 // f(u,v) = (1-u)c4(v) + u c2(v) + (1-v)c1(u) + v c3(u)
 //          - [ (1-u)(1-v)s1 + u(1-v)s2 + uv s3 + (1-u)v s4 ]
@@ -606,7 +602,7 @@ Vertex InterpolateSurface(Surface *s, double u, double v, int derivee, int u_v)
 {
   if(derivee) {
     double eps = 1.e-6;
-    Vertex D[4], T;
+    Vertex D[4];
     if(u_v == 1) {
       if(u - eps < 0.0) {
         D[0] = InterpolateSurface(s, u, v, 0, 0);
@@ -627,19 +623,14 @@ Vertex InterpolateSurface(Surface *s, double u, double v, int derivee, int u_v)
         D[1] = InterpolateSurface(s, u, v, 0, 0);
       }
     }
-    T.Pos.X = (D[1].Pos.X - D[0].Pos.X) / eps;
-    T.Pos.Y = (D[1].Pos.Y - D[0].Pos.Y) / eps;
-    T.Pos.Z = (D[1].Pos.Z - D[0].Pos.Z) / eps;
-    return T;
+    return Vertex((D[1].Pos.X - D[0].Pos.X) / eps,
+                  (D[1].Pos.Y - D[0].Pos.Y) / eps,
+                  (D[1].Pos.Z - D[0].Pos.Z) / eps);
   }
 
   if(s->geometry){
-    Vertex T;
     SPoint3 p = s->geometry->point(u, v);
-    T.Pos.X = p.x();
-    T.Pos.Y = p.y();
-    T.Pos.Z = p.z();
-    return T;
+    return Vertex(p.x(), p.y(), p.z());
   }
 
   // FIXME: WARNING -- this is a major hack: we use the exact
@@ -655,35 +646,17 @@ Vertex InterpolateSurface(Surface *s, double u, double v, int derivee, int u_v)
   case MSH_SURF_TRIC: 
     return InterpolateRuledSurface(s, u, v);
   case MSH_SURF_PLAN:
-    {
-      Msg::Error("You should never be here (InterpolateSurface(MSH_PLANE)): contact support ;-)");
-      Vertex T(u, v, 0.);
-      Vertex V(s->a, s->b, s->c);
-      Projette(&V, s->plan);
-      if(V.Pos.Z != 0.)
-        T.Pos.Z = (s->d - V.Pos.X * T.Pos.X - V.Pos.Y * T.Pos.Y) / V.Pos.Z;
-      else
-        T.Pos.Z = 0.;
-      return T;
-    }
+    Msg::Error("Should never interpolate plane surface in InterpolateSurface()");
+    return Vertex(0., 0., 0.);
   case MSH_SURF_BND_LAYER:
-    {
-      Msg::Error("Cannot interpolate boundary layer surface");
-      Vertex T(0., 0., 0.);
-      return T;
-    }    
+    Msg::Error("Cannot interpolate boundary layer surface");
+    return Vertex(0., 0., 0.);
   case MSH_SURF_DISCRETE:
-    {
-      Msg::Error("Cannot interpolate discrete surface");
-      Vertex T(0., 0., 0.);
-      return T;
-    }    
+    Msg::Error("Cannot interpolate discrete surface");
+    return Vertex(0., 0., 0.);
   default:
-    {
-      Msg::Error("Unknown surface type in interpolation");
-      Vertex T(0., 0., 0.);
-      return T;
-    }
+    Msg::Error("Unknown surface type in interpolation");
+    return Vertex(0., 0., 0.);
   }
 }
 
diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp
index 42d197c491..3d46a89b6b 100644
--- a/Geo/gmshFace.cpp
+++ b/Geo/gmshFace.cpp
@@ -35,19 +35,10 @@ gmshFace::gmshFace(GModel *m, Surface *face)
       Msg::Error("Unknown curve %d", c->Num);
   }
 
-  // always compute and store the mean plane for plane surfaces
-  // (simply using the bounding vertices)
-  if(s->Typ == MSH_SURF_PLAN){
-    computeMeanPlane();
-    for(int i = 0; i < 3; i++)
-      for(int j = 0; j < 3; j++)
-        s->plan[i][j] = meanPlane.plan[i][j];
-    s->a = meanPlane.a;
-    s->b = meanPlane.b;
-    s->c = meanPlane.c;
-    s->d = meanPlane.d;
-  }
-  
+  // always compute and store the mean plane for plane surfaces (using
+  // the bounding vertices)
+  if(s->Typ == MSH_SURF_PLAN) computeMeanPlane();
+
   if(s->EmbeddedCurves){
     for(int i = 0; i < List_Nbr(s->EmbeddedCurves); i++){
       Curve *c;
-- 
GitLab