From 0d1df915048adc0b6b82c92559d04d540a0ffdd1 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 29 May 2003 14:36:56 +0000 Subject: [PATCH] Added warning + option for circle/ellipse arcs >= Pi --- Common/Context.h | 3 ++- Common/DefaultOptions.h | 2 ++ Common/Options.cpp | 9 ++++++++- Common/Options.h | 1 + Mesh/Create.cpp | 11 ++++++++++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Common/Context.h b/Common/Context.h index 1de2ee0791..4fbcc3c473 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -137,7 +137,8 @@ public : int point_type, line_type; // flat or 3D int hidden, shade; int highlight; - int level, old_circle, circle_points, extrude_spline_points, old_newreg; + int level, old_circle, circle_points, circle_warning; + int extrude_spline_points, old_newreg; double normals, tangents; double scaling_factor; int color_scheme ; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index b61a4a34cc..1e3de084f5 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -604,6 +604,8 @@ StringXNumber GeometryOptions_Number[] = { "Number of points used to draw a circle/ellipse" }, { F|O, "ColorScheme" , opt_geometry_color_scheme , 0. , "Default geometry color scheme (0, 1 or 2)" }, + { F|O, "CircleWarning" , opt_geometry_circle_warning, 1. , + "Warn if circle arc is greater than Pi" }, { F|O, "ExtrudeSplinePoints" , opt_geometry_extrude_spline_points, 5. , "Number of control points for splines created during extrusion" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 4a8312e251..358b5b05a6 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.106 2003-04-15 18:32:01 geuzaine Exp $ +// $Id: Options.cpp,v 1.107 2003-05-29 14:36:56 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -2840,6 +2840,13 @@ double opt_geometry_circle_points(OPT_ARGS_NUM) return CTX.geom.circle_points; } +double opt_geometry_circle_warning(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.geom.circle_warning = (int)val; + return CTX.geom.circle_warning; +} + double opt_geometry_extrude_spline_points(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index c43c79b12e..087701ab17 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -321,6 +321,7 @@ double opt_geometry_highlight(OPT_ARGS_NUM); double opt_geometry_old_circle(OPT_ARGS_NUM); double opt_geometry_old_newreg(OPT_ARGS_NUM); double opt_geometry_circle_points(OPT_ARGS_NUM); +double opt_geometry_circle_warning(OPT_ARGS_NUM); double opt_geometry_extrude_spline_points(OPT_ARGS_NUM); double opt_geometry_scaling_factor(OPT_ARGS_NUM); double opt_geometry_color_scheme(OPT_ARGS_NUM); diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp index e272da4263..137ce51eae 100644 --- a/Mesh/Create.cpp +++ b/Mesh/Create.cpp @@ -1,4 +1,4 @@ -// $Id: Create.cpp,v 1.44 2003-04-10 13:12:36 remacle Exp $ +// $Id: Create.cpp,v 1.45 2003-05-29 14:36:56 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -395,6 +395,15 @@ void End_Curve(Curve * c) for(i = 0; i < 4; i++) Curve->Circle.v[i] = v[i]; + + if(CTX.geom.circle_warning && Curve->Num > 0 && A3-A1 >= Pi){ + Msg(GERROR1, "Circle or ellipse arc %d greater than/equal to Pi (angle=%g)", + Curve->Num, A3-A1); + Msg(GERROR2, "(If you understand what this implies, you can disable this error"); + Msg(GERROR2, "message by setting Geometry.CircleWarning to 0. Otherwise, please"); + Msg(GERROR3, "subdivide the arc in smaller pieces)"); + } + } if(c->cp) -- GitLab