From 94a1001e6a493864e4275ca06fa7e94649e90e4a Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 8 Nov 2002 07:27:57 +0000
Subject: [PATCH] Added an option to set the number of subdivisions used when
 drawing spheres (when geometry, mesh or post-processing points are drawn as
 3D spheres). You can test with:

gmsh tutorial/t5.geo -string "Geometry.PointType=1; Geometry.PointSize=8; General.SphereSubdivisions=10;"
---
 Common/Context.h        | 1 +
 Common/DefaultOptions.h | 2 ++
 Common/Options.cpp      | 7 ++++++-
 Common/Options.h        | 1 +
 Graphics/Entity.cpp     | 4 ++--
 5 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index 4e9586577d..b525c438b8 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -120,6 +120,7 @@ public :
   double pixel_equiv_x, pixel_equiv_y ; 
                               // approximative equivalent model length of a pixel 
   int color_scheme ;          // general color scheme
+  int sphere_subdivisions;    // nb subd to draw spheres, when drawing pts as 3D spheres
 
   // geometry options 
   struct{
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 5ba7736387..1000da684f 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -533,6 +533,8 @@ StringXNumber GeneralOptions_Number[] = {
     "X position of small axes (negative values for right alignment)" },
   { F|O, "SmallAxesPositionY" , opt_general_small_axes_position1 , -35. ,
     "Y position of small axes (negative values for bottom alignment)" },
+  { F|O, "SphereSubdivisions" , opt_general_sphere_subdivisions, 10. ,
+    "Number of subdivisions used to draw spheres (when drawing points as spheres)" },
 
 #ifdef _FLTK
   { F|O, "Terminal" , opt_general_terminal , 0. ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 3c546869bf..8592490bac 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.89 2002-11-08 02:06:59 geuzaine Exp $
+// $Id: Options.cpp,v 1.90 2002-11-08 07:27:57 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -1166,6 +1166,11 @@ double opt_general_small_axes_position1(OPT_ARGS_NUM){
     CTX.small_axes_pos[1] = (int)val;
   return CTX.small_axes_pos[1];
 }
+double opt_general_sphere_subdivisions(OPT_ARGS_NUM){
+  if(action & GMSH_SET) 
+    CTX.sphere_subdivisions = (int)val;
+  return CTX.sphere_subdivisions;
+}
 double opt_general_display_lists(OPT_ARGS_NUM){
   int i;
   if(action & GMSH_SET){
diff --git a/Common/Options.h b/Common/Options.h
index d7c68745cf..fc134dd254 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -228,6 +228,7 @@ double opt_general_axes(OPT_ARGS_NUM);
 double opt_general_small_axes(OPT_ARGS_NUM);
 double opt_general_small_axes_position0(OPT_ARGS_NUM);
 double opt_general_small_axes_position1(OPT_ARGS_NUM);
+double opt_general_sphere_subdivisions(OPT_ARGS_NUM);
 double opt_general_display_lists(OPT_ARGS_NUM);
 double opt_general_double_buffer(OPT_ARGS_NUM);
 double opt_general_alpha_blending(OPT_ARGS_NUM);
diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index ca17d3a781..4055e397d7 100644
--- a/Graphics/Entity.cpp
+++ b/Graphics/Entity.cpp
@@ -1,4 +1,4 @@
-// $Id: Entity.cpp,v 1.22 2002-11-08 02:06:59 geuzaine Exp $
+// $Id: Entity.cpp,v 1.23 2002-11-08 07:27:57 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -48,7 +48,7 @@ void Draw_Sphere (double size, double x, double y, double z){
     qua = gluNewQuadric();
     listnum = glGenLists(1);
     glNewList(listnum, GL_COMPILE);
-    gluSphere(qua, 1, 20,20);
+    gluSphere(qua, 1, CTX.sphere_subdivisions, CTX.sphere_subdivisions);
     glEndList();
   }
   glPushMatrix(); 
-- 
GitLab