diff --git a/Common/Context.h b/Common/Context.h index 1de2ee0791912be9d8e63d21caf7a1987b6478c4..4fbcc3c473b0320841f3d93b3906e87e19bcd2a6 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 b61a4a34ccbb113954968eea26841f91165086fe..1e3de084f524e7780caf34833b16913142efb93c 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 4a8312e251400919c9bcae46ff55fcf52380c465..358b5b05a6156a808f09c7d680c48efc64f70db9 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 c43c79b12e0b087d65ee5f871f4ff73b4f2c97d0..087701ab17d62a7fb32d1322801790e1c257f5e5 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 e272da4263c36b1aa89726b829145ce9fba5cce2..137ce51eae8741fc7dee5b64c45768290507769b 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)