diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index fe76e48eeec6dbed7efe971b3e6c52c2945b3a7c..2773aecb136fd89d80d90aec5e09ae00ec7f7d9d 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -457,10 +457,10 @@ StringXNumber ViewOptions_Number[] = { "Draw the N-b dimensional boundary of the simplex (N=dimension, b=option value)" }, { F|O, "Light" , opt_view_light , 0. , "Enable light sources?" }, - { F|O, "AngleSmoothNormals" , opt_view_angle_smooth_normals , 15. , - "Treshold angle below which we do not smooth the normals" }, { F|O, "SmoothNormals" , opt_view_smooth_normals , 0. , "Smooth the normals?" }, + { F|O, "AngleSmoothNormals" , opt_view_angle_smooth_normals , 15. , + "Threshold angle below which we do not smooth the normals" }, { F|O, "ShowElement" , opt_view_show_element , 0. , "Show element boundaries?" }, { F|O, "ShowTime" , opt_view_show_time , 1. , diff --git a/Common/Options.cpp b/Common/Options.cpp index c9326219765730de1680d2c0e28fb52e00672448..aa38b13ffabb7e2f77489f1b4bedfdba1765cc29 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.41 2001-08-23 17:19:02 geuzaine Exp $ +// $Id: Options.cpp,v 1.42 2001-08-23 18:03:45 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -1820,14 +1820,14 @@ double opt_view_smooth_normals(OPT_ARGS_NUM){ double opt_view_angle_smooth_normals(OPT_ARGS_NUM){ GET_VIEW(0.) ; if(action & GMSH_SET){ - v->angle_smooth_normals = val; + v->AngleSmoothNormals = val; v->Changed = 1; } -// #ifdef _FLTK -// if(WID && (action & GMSH_GUI) && (num == WID->view_number)) -// WID->view_butt[27]->value(v->SmoothNormals); -// #endif - return v->angle_smooth_normals; +#ifdef _FLTK + if(WID && (action & GMSH_GUI) && (num == WID->view_number)) + WID->view_value[13]->value(v->AngleSmoothNormals); +#endif + return v->AngleSmoothNormals; } double opt_view_show_element(OPT_ARGS_NUM){ GET_VIEW(0.) ; diff --git a/Common/Views.cpp b/Common/Views.cpp index 7d8c7c1f5b9af1cd46575d6a2aad32a9e6e9f8c1..417ebf1e2925d3db93ce31f4dcf8eef72f3ea2c4 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.52 2001-08-23 17:19:03 geuzaine Exp $ +// $Id: Views.cpp,v 1.53 2001-08-23 18:03:45 geuzaine Exp $ #include <set> #include "Gmsh.h" @@ -403,7 +403,7 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ dest->NbIso = src->NbIso; dest->Light = src->Light ; dest->SmoothNormals = src->SmoothNormals ; - dest->angle_smooth_normals = src->angle_smooth_normals ; + dest->AngleSmoothNormals = src->AngleSmoothNormals ; dest->ShowElement = src->ShowElement; dest->ShowTime = src->ShowTime; dest->ShowScale = src->ShowScale; @@ -662,7 +662,6 @@ public: static double eps; void update (int nbVals, double *); xyzv(double x, double y, double z); - xyzv(double x, double y, double z, double* v); ~xyzv(); xyzv & operator = ( const xyzv &); xyzv ( const xyzv &); @@ -673,9 +672,6 @@ double xyzv::eps = 0.0; xyzv::xyzv (double xx, double yy, double zz) : x(xx),y(yy),z(zz),vals(0),nbvals(0),nboccurences(0){} -xyzv::xyzv (double xx, double yy, double zz, double *vv) - : x(xx),y(yy),z(zz),vals(vv),nbvals(0),nboccurences(0){} - xyzv::~xyzv(){ if(vals)delete [] vals; } @@ -727,12 +723,6 @@ void xyzv::update (int n, double *v){ //printf("val(%d,%f,%f,%f) = %f\n",nboccurences,x,y,z,vals[0]); } -// trop simple... If faudrait coder une structure qui tient compte des -// angles entres normales, qui ne smoothe que si p1.val est "proche" -// (eps2) de p2.val, et qui renvoie le xyzv qui a le xyz dans eps ET -// val eps2... Sinon, pour un smoothing de normales, les "coins" -// deviennent de la bouillie. -/* struct lessthanxyzv{ bool operator () (const xyzv & p2, const xyzv &p1) const{ if( p1.x - p2.x > xyzv::eps)return true; @@ -743,37 +733,6 @@ struct lessthanxyzv{ return false; } }; -*/ - -double angle_normals (double * aa, double * bb){ - double angplan, cosc, sinc, a[3],b[3],c[3]; - if(!aa || !bb) return 0.; - a[0] = aa[0]; - a[1] = aa[1]; - a[2] = aa[2]; - b[0] = bb[0]; - b[1] = bb[1]; - b[2] = bb[2]; - norme (a); - norme (b); - prodve (a, b, c); - prosca (a, b, &cosc); - sinc = sqrt (c[0] * c[0] + c[1] * c[1] + c[2] * c[2]); - angplan = myatan2 (sinc, cosc); - return angplan*180./Pi; -} - -struct lessthanxyzv{ - bool operator () (const xyzv & p2, const xyzv &p1) const{ - if( p1.x - p2.x > xyzv::eps)return true; - if( p1.x - p2.x <-xyzv::eps)return false; - if( p1.y - p2.y > xyzv::eps)return true; - if( p1.y - p2.y <-xyzv::eps)return false; - if( p1.z - p2.z > xyzv::eps)return true; - if( p1.z - p2.z <-xyzv::eps)return false; - return false; - } -}; typedef set<xyzv,lessthanxyzv> mycont; typedef mycont::const_iterator iter; @@ -884,6 +843,23 @@ void Post_View :: add_normal(double x, double y, double z, } } +double get_angle (double * aa, double * bb){ + double angplan, cosc, sinc, a[3],b[3],c[3]; + if(!aa || !bb) return 0.; + a[0] = aa[0]; + a[1] = aa[1]; + a[2] = aa[2]; + b[0] = bb[0]; + b[1] = bb[1]; + b[2] = bb[2]; + norme (a); + norme (b); + prodve (a, b, c); + prosca (a, b, &cosc); + sinc = sqrt (c[0] * c[0] + c[1] * c[1] + c[2] * c[2]); + angplan = myatan2 (sinc, cosc); + return angplan*180./Pi; +} bool Post_View :: get_normal(double x, double y, double z, double &nx, double &ny, double &nz){ @@ -896,9 +872,9 @@ bool Post_View :: get_normal(double x, double y, double z, if(it == normals->c.end()) return false; - double angle = angle_normals ((*it).vals, n); + double angle = get_angle ((*it).vals, n); - if(fabs(angle) < angle_smooth_normals) + if(fabs(angle) < AngleSmoothNormals) { nx = (*it).vals[0]; ny = (*it).vals[1]; diff --git a/Common/Views.h b/Common/Views.h index e83a426404bad6c218e0f18e999b646345c9907b..cd514cb40f4d102edc53b45e38e7b7b6d1e1ef97 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -30,7 +30,7 @@ class Post_View{ double CustomMin, CustomMax; double Offset[3], Raise[3], ArrowScale, Explode; int Visible, IntervalsType, NbIso, Light, SmoothNormals ; - double angle_smooth_normals; + double AngleSmoothNormals; int SaturateValues; int ShowElement, ShowTime, ShowScale; int TransparentScale, ScaleType, RangeType; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 73ff91feebf2dfc3595cf605646e2de87b593d16..604a07ae5666ebd61a814e2dcba71949b8ae01cc 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.81 2001-08-20 07:38:29 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.82 2001-08-23 18:03:45 geuzaine Exp $ #include <sys/types.h> #include <signal.h> @@ -1859,6 +1859,9 @@ void view_options_ok_cb(CALLBACK_ARGS){ if(force || WID->view_value[12]->changed()) opt_view_explode(i, GMSH_SET, WID->view_value[12]->value()); + if(force || WID->view_value[13]->changed()) + opt_view_angle_smooth_normals(i,GMSH_SET,WID->view_value[13]->value()); + // view_inputs if(force || WID->view_input[0]->changed()) diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index a4393d5889f2ebf3c426a91cf482b7ef164f86e2..fdc2a01e44afe404ecdd790771b737916fbd3f08 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.109 2001-08-20 07:38:29 geuzaine Exp $ +// $Id: GUI.cpp,v 1.110 2001-08-23 18:03:45 geuzaine Exp $ // To make the interface as visually consistent as possible, please: // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. @@ -1993,6 +1993,16 @@ void GUI::create_view_options_window(int num){ view_butt[27]->selection_color(FL_YELLOW); view_butt[27]->callback(set_changed_cb, 0); + view_value[13] = new Fl_Value_Input(2*WB, 2*WB+9*BH, IW, BH, "Angle"); + view_value[13]->labelsize(CTX.fontsize); + view_value[13]->textsize(CTX.fontsize); + view_value[13]->type(FL_HORIZONTAL); + view_value[13]->align(FL_ALIGN_RIGHT); + view_value[13]->minimum(0.); + view_value[13]->step(1.); + view_value[13]->maximum(180.); + view_value[13]->callback(set_changed_cb, 0); + view_value[11] = new Fl_Value_Input(width/2, 2*WB+ 1*BH, IW, BH, "Boundary"); view_value[11]->labelsize(CTX.fontsize); view_value[11]->textsize(CTX.fontsize); @@ -2300,6 +2310,7 @@ void GUI::update_view_window(int num){ // light opt_view_light(num, GMSH_GUI, 0); opt_view_smooth_normals(num, GMSH_GUI, 0); + opt_view_angle_smooth_normals(num, GMSH_GUI, 0); // OK view_ok->callback(view_options_ok_cb, (void*)num); diff --git a/doc/VERSIONS b/doc/VERSIONS index d2a9520288d8f46d0fd95b8add5f115688ba2685..0d81912273159fdf3c9d55392e20baec56f81d99 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,8 +1,9 @@ -$Id: VERSIONS,v 1.59 2001-08-20 07:47:01 geuzaine Exp $ +$Id: VERSIONS,v 1.60 2001-08-23 18:03:45 geuzaine Exp $ New in 1.24: Fixed characteristic length interpolation for Splines; Added BSplines; Integrated Jonathan Shewchuk's Triangle as an -alternative isotropic 2D mesh generator; +alternative isotropic 2D mesh generator; New AngleSmoothNormals +option; New in 1.23: Fixed duplicate elements generation + non-matching tetrahedra faces in 3D extruded meshes; Better display of displacement