diff --git a/Common/Context.h b/Common/Context.h index 72f0b8298a53a883a6b8943b410d06106bee8f5a..959ca6df3a529d9599dd8865251a7aad40ce7ee5 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -119,7 +119,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 + int quadric_subdivisions; // nb of subdivisions for gluQuadrics (spheres/cylinders) // geometry options struct{ @@ -127,7 +127,7 @@ public : int points, lines, surfaces, volumes; int points_num, lines_num, surfaces_num, volumes_num; double point_size, line_width, point_sel_size, line_sel_width; - int point_type; // flat or 3D sphere + int point_type, line_type; // flat or 3D int hidden, shade; int highlight; int level, old_circle, circle_points, extrude_spline_points, old_newreg; @@ -143,7 +143,7 @@ public : int draw; int points, lines, surfaces, volumes; int points_num, lines_num, surfaces_num, volumes_num; - int point_type; // flat or 3D sphere + int point_type, line_type; // flat or 3D double point_size, line_width; double quality; double gamma_inf, gamma_sup, radius_inf, radius_sup; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index b9143edd51101b9e71d24cf962e095397853d7db..306fc5f0f46ad374b0f2653ee5d7684719ddc66e 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -506,6 +506,9 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "PointSize" , opt_general_point_size , 3. , "Display size of points (in pixels)" }, + { F|O, "QuadricSubdivisions" , opt_general_quadric_subdivisions, 10. , + "Number of subdivisions used to draw points or lines as spheres or cylinders" }, + { F, "RotationX" , opt_general_rotation0 , 0.0 , "First Euler angle (used if Trackball == 0)" }, { F, "RotationY" , opt_general_rotation1 , 0.0 , @@ -531,8 +534,6 @@ 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. , @@ -592,6 +593,8 @@ StringXNumber GeometryOptions_Number[] = { "Display curve numbers?" }, { F|O, "LineSelectWidth" , opt_geometry_line_sel_width , 2. , "Display width of selected lines (in pixels)" }, + { F|O, "LineType" , opt_geometry_line_type , 0. , + "Display lines as solid color segments or 3D cylinders" }, { F|O, "LineWidth" , opt_geometry_line_width , 1.0 , "Display width of lines (in pixels)" }, @@ -686,6 +689,8 @@ StringXNumber MeshOptions_Number[] = { "Display mesh vertices on curves?" }, { F|O, "LinesNumbers" , opt_mesh_lines_num , 0. , "Display mesh line numbers?" }, + { F|O, "LineType" , opt_mesh_line_type , 0. , + "Display lines as solid color segments or 3D cylinders" }, { F|O, "LineWidth" , opt_mesh_line_width , 1.0 , "Display width of lines (in pixels)" }, @@ -875,6 +880,8 @@ StringXNumber ViewOptions_Number[] = { { F|O, "Light" , opt_view_light , 0. , "Enable light sources?" }, + { F|O, "LineType" , opt_view_line_type , 0. , + "Display lines as solid color segments or 3D cylinders" }, { F|O, "LineWidth" , opt_view_line_width , 1.0 , "Display width of lines (in pixels)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index b9c420ee05bfaadcc757f2e54d96366bb5226128..207e026fc7c5fe1d39a63814b1cc17cef5898442 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.92 2002-11-08 20:17:12 geuzaine Exp $ +// $Id: Options.cpp,v 1.93 2002-11-16 08:29:14 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -1166,10 +1166,10 @@ 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){ +double opt_general_quadric_subdivisions(OPT_ARGS_NUM){ if(action & GMSH_SET) - CTX.sphere_subdivisions = (int)val; - return CTX.sphere_subdivisions; + CTX.quadric_subdivisions = (int)val; + return CTX.quadric_subdivisions; } double opt_general_double_buffer(OPT_ARGS_NUM){ if(action & GMSH_SET){ @@ -1613,6 +1613,17 @@ double opt_geometry_line_sel_width(OPT_ARGS_NUM){ CTX.geom.line_sel_width = val; return CTX.geom.line_sel_width; } +double opt_geometry_line_type(OPT_ARGS_NUM){ + if(action & GMSH_SET){ + CTX.geom.line_type = (int)val; + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI)){ + WID->geo_choice[1]->value(CTX.geom.line_type); + } +#endif + return CTX.geom.line_type; +} double opt_geometry_aspect(OPT_ARGS_NUM){ if(action & GMSH_SET){ switch((int)val){ @@ -1901,6 +1912,18 @@ double opt_mesh_line_width(OPT_ARGS_NUM){ #endif return CTX.mesh.line_width; } +double opt_mesh_line_type(OPT_ARGS_NUM){ + if(action & GMSH_SET){ + CTX.mesh.line_type = (int)val; + CTX.mesh.changed = 1; + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI)){ + WID->mesh_choice[1]->value(CTX.mesh.line_type); + } +#endif + return CTX.mesh.line_type; +} double opt_mesh_aspect(OPT_ARGS_NUM){ if(action & GMSH_SET){ switch((int)val){ @@ -2919,6 +2942,19 @@ double opt_view_point_type(OPT_ARGS_NUM){ #endif return v->PointType; } +double opt_view_line_type(OPT_ARGS_NUM){ + GET_VIEW(0.) ; + if(action & GMSH_SET){ + v->LineType = (int)val; + v->Changed = 1; + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI) && (num == WID->view_number)){ + WID->view_choice[6]->value(v->LineType?1:0); + } +#endif + return v->LineType; +} double opt_print_format(OPT_ARGS_NUM){ diff --git a/Common/Options.h b/Common/Options.h index 3b82da70064f2d00022c26be92d5cbf95209dfca..86f5be71b402b7edc13a2fec22bfa07ff5c605da 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -228,7 +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_quadric_subdivisions(OPT_ARGS_NUM); double opt_general_double_buffer(OPT_ARGS_NUM); double opt_general_alpha_blending(OPT_ARGS_NUM); double opt_general_trackball(OPT_ARGS_NUM); @@ -305,6 +305,7 @@ double opt_geometry_point_sel_size(OPT_ARGS_NUM); double opt_geometry_point_type(OPT_ARGS_NUM); double opt_geometry_line_width(OPT_ARGS_NUM); double opt_geometry_line_sel_width(OPT_ARGS_NUM); +double opt_geometry_line_type(OPT_ARGS_NUM); double opt_geometry_aspect(OPT_ARGS_NUM); double opt_geometry_highlight(OPT_ARGS_NUM); double opt_geometry_old_circle(OPT_ARGS_NUM); @@ -335,6 +336,7 @@ double opt_mesh_volumes_num(OPT_ARGS_NUM); double opt_mesh_point_size(OPT_ARGS_NUM); double opt_mesh_point_type(OPT_ARGS_NUM); double opt_mesh_line_width(OPT_ARGS_NUM); +double opt_mesh_line_type(OPT_ARGS_NUM); double opt_mesh_aspect(OPT_ARGS_NUM); double opt_mesh_format(OPT_ARGS_NUM); double opt_mesh_nb_smoothing(OPT_ARGS_NUM); @@ -444,6 +446,7 @@ double opt_view_arrow_location(OPT_ARGS_NUM); double opt_view_point_size(OPT_ARGS_NUM); double opt_view_line_width(OPT_ARGS_NUM); double opt_view_point_type(OPT_ARGS_NUM); +double opt_view_line_type(OPT_ARGS_NUM); double opt_print_format(OPT_ARGS_NUM); double opt_print_eps_quality(OPT_ARGS_NUM); double opt_print_eps_background(OPT_ARGS_NUM); diff --git a/Common/Views.cpp b/Common/Views.cpp index e2d4fed09d1529b2f2aea9bd82605c4508d8efc9..ddffe96886755dde52dafe7d113acc0fa0bbb0df 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.81 2002-11-13 02:36:20 geuzaine Exp $ +// $Id: Views.cpp,v 1.82 2002-11-16 08:29:14 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -531,6 +531,7 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ dest->PointSize = src->PointSize; dest->LineWidth = src->LineWidth; dest->PointType = src->PointType; + dest->LineType = src->LineType; dest->Grid = src->Grid; ColorTable_Copy(&src->CT); ColorTable_Paste(&dest->CT); diff --git a/Common/Views.h b/Common/Views.h index e58275cd1acc64c36cc5c08e247c14ee195c47b4..182faf80e4b74e417bfb69b60bb142eef3195103 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -73,7 +73,7 @@ class Post_View{ int DrawPoints, DrawLines, DrawTriangles, DrawQuadrangles; int DrawTetrahedra, DrawHexahedra, DrawPrisms, DrawPyramids; int DrawScalars, DrawVectors, DrawTensors; - int Boundary, Grid, PointType; + int Boundary, Grid, PointType, LineType; double PointSize, LineWidth; GmshColorTable CT; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 14c21c3a319f24203758532a58ee8dc9bc0a9d4e..e515e290461926a19b8dc01301b3ff9c6962c4f4 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.150 2002-11-08 18:56:21 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.151 2002-11-16 08:29:15 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -669,6 +669,7 @@ void opt_geometry_ok_cb(CALLBACK_ARGS) { opt_geometry_point_sel_size(0, GMSH_SET, WID->geo_value[5]->value()); opt_geometry_point_type(0, GMSH_SET, WID->geo_choice[0]->value()); + opt_geometry_line_type(0, GMSH_SET, WID->geo_choice[1]->value()); Draw(); } @@ -718,6 +719,7 @@ void opt_mesh_ok_cb(CALLBACK_ARGS) { opt_mesh_line_width(0, GMSH_SET, WID->mesh_value[11]->value()); opt_mesh_point_type(0, GMSH_SET, WID->mesh_choice[0]->value()); + opt_mesh_line_type(0, GMSH_SET, WID->mesh_choice[1]->value()); Draw(); } @@ -2323,6 +2325,15 @@ void view_options_ok_cb(CALLBACK_ARGS){ opt_view_point_type(i, GMSH_SET, val); } + if(force || WID->view_choice[6]->changed()){ + int val; + switch(WID->view_choice[6]->value()){ + case 0 : val = 0; break; + default : val = 1; break; + } + opt_view_line_type(i, GMSH_SET, val); + } + if(force || WID->view_choice[2]->changed()){ int val; switch(WID->view_choice[2]->value()){ diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 0423b952d95ca6c898234f8c3987a96d70eee438..f9fcbca69b901fdeeb6cfd2e88a847b6672b5cb0 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.212 2002-11-13 06:16:12 geuzaine Exp $ +// $Id: GUI.cpp,v 1.213 2002-11-16 08:29:15 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -335,6 +335,12 @@ static Fl_Menu_Item menu_point_display[] = { {0} }; +static Fl_Menu_Item menu_line_display[] = { + {"Color segment", 0, 0, 0}, + {"3D cylinder", 0, 0, 0}, + {0} +}; + // Definition of global shortcuts int GUI::global_shortcuts(int event){ @@ -1368,6 +1374,10 @@ void GUI::create_geometry_options_window(){ geo_value[4]->maximum(50); geo_value[4]->step(0.1); + geo_choice[1] = new Fl_Choice(2*WB, 2*WB+5*BH, IW, BH, "Line display"); + geo_choice[1]->menu(menu_line_display); + geo_choice[1]->align(FL_ALIGN_RIGHT); + for(i=3 ; i<= 5 ; i++){ geo_value[i]->align(FL_ALIGN_RIGHT); } @@ -1561,6 +1571,10 @@ void GUI::create_mesh_options_window(){ mesh_choice[0]->menu(menu_point_display); mesh_choice[0]->align(FL_ALIGN_RIGHT); + mesh_choice[1] = new Fl_Choice(2*WB, 2*WB+8*BH, IW, BH, "Line display"); + mesh_choice[1]->menu(menu_line_display); + mesh_choice[1]->align(FL_ALIGN_RIGHT); + o->end(); } { @@ -2537,10 +2551,15 @@ void GUI::create_view_options_window(int num){ view_value[62]->align(FL_ALIGN_RIGHT); view_value[62]->callback(set_changed_cb, 0); + view_choice[6] = new Fl_Choice(2*WB, 2*WB+ 4*BH, IW, BH, "Line display"); + view_choice[6]->menu(menu_line_display); + view_choice[6]->align(FL_ALIGN_RIGHT); + view_choice[6]->callback(set_changed_cb, 0); + { view_vector = new Fl_Group(2*WB, 2*WB+ 4*BH, width/2, 5*BH, 0); - view_value[60] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, "Vector size"); + view_value[60] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Vector size"); view_value[60]->minimum(0); view_value[60]->align(FL_ALIGN_RIGHT); view_value[60]->callback(set_changed_cb, 0); @@ -2553,7 +2572,7 @@ void GUI::create_view_options_window(int num){ {"Displacement", 0, 0, 0}, {0} }; - view_choice[2] = new Fl_Choice(2*WB, 2*WB+5*BH, IW, BH, "Vector display"); + view_choice[2] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Vector display"); view_choice[2]->menu(menu_vectype); view_choice[2]->align(FL_ALIGN_RIGHT); view_choice[2]->callback(set_changed_cb, 0); @@ -2563,7 +2582,7 @@ void GUI::create_view_options_window(int num){ {"Vertex centered", 0, 0, 0}, {0} }; - view_choice[3] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Vector location"); + view_choice[3] = new Fl_Choice(2*WB, 2*WB+7*BH, IW, BH, "Vector location"); view_choice[3]->menu(menu_vecloc); view_choice[3]->align(FL_ALIGN_RIGHT); view_choice[3]->callback(set_changed_cb, 0); @@ -2573,7 +2592,7 @@ void GUI::create_view_options_window(int num){ {"Eigenvectors", 0, 0, 0}, {0} }; - view_choice[4] = new Fl_Choice(2*WB, 2*WB+7*BH, IW, BH, "Tensor display"); + view_choice[4] = new Fl_Choice(2*WB, 2*WB+8*BH, IW, BH, "Tensor display"); view_choice[4]->menu(menu_tensor); view_choice[4]->align(FL_ALIGN_RIGHT); view_choice[4]->callback(set_changed_cb, 0); @@ -2739,6 +2758,7 @@ void GUI::update_view_window(int num){ opt_view_point_size(num, GMSH_GUI, 0); opt_view_point_type(num, GMSH_GUI, 0); opt_view_line_width(num, GMSH_GUI, 0); + opt_view_line_type(num, GMSH_GUI, 0); opt_view_arrow_type(num, GMSH_GUI, 0); opt_view_arrow_scale(num, GMSH_GUI, 0); opt_view_arrow_location(num, GMSH_GUI, 0); diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 5769ac8b2b3de85476f9e2aa5a6cf6fb6a353082..7fc94bd24bdc1ca39e21f5d0b1379ca71c261b77 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -72,8 +72,9 @@ void Draw_Scales(void); void Draw_Axes (double s); void Draw_SmallAxes(void); void Draw_Sphere(double size, double x, double y, double z); +void Draw_Cylinder (double width, double *x, double *y, double *z); void Draw_Point(int type, double size, double *x, double *y, double *z, double Raise[3][8]); -void Draw_Line (double *x, double *y, double *z, double Raise[3][8]); +void Draw_Line (int type, double width, double *x, double *y, double *z, double Raise[3][8]); void Draw_Triangle (double *x, double *y, double *z,double *n, double Raise[3][8], int shade); void Draw_Quadrangle (double *x, double *y, double *z, double *n, diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index 4055e397d7bfbf99df0a5f780b5097a3dfef1e58..07bd3f5c75a9ee05aa42c5143e0ab87223db2c6c 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.23 2002-11-08 07:27:57 geuzaine Exp $ +// $Id: Entity.cpp,v 1.24 2002-11-16 08:29:15 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, CTX.sphere_subdivisions, CTX.sphere_subdivisions); + gluSphere(qua, 1, CTX.quadric_subdivisions, CTX.quadric_subdivisions); glEndList(); } glPushMatrix(); @@ -58,11 +58,74 @@ void Draw_Sphere (double size, double x, double y, double z){ glPopMatrix(); } -void Draw_Line (double *x, double *y, double *z, double Raise[3][8]){ - glBegin(GL_LINES); - glVertex3d(x[0]+Raise[0][0], y[0]+Raise[1][0], z[0]+Raise[2][0]); - glVertex3d(x[1]+Raise[0][1], y[1]+Raise[1][1], z[1]+Raise[2][1]); - glEnd(); +void Draw_Cylinder (double width, double *x, double *y, double *z){ + double mat[4][4], r[3]; + static GLUquadricObj *qua; + static int first = 1; + //static listnum; + + float s = width*CTX.pixel_equiv_x/CTX.s[0]; // width is in pixels + if(first){ + first = 0; + qua = gluNewQuadric(); + //listnum = glGenLists(1); + //glNewList(listnum, GL_COMPILE); + //gluCylinder(qua, 1, 1, 1, CTX.quadric_subdivisions, 1); + //glEndList(); + } + + r[0] = x[1]-x[0]; r[1] = y[1]-y[0]; r[2] = z[1]-z[0]; + double rn = sqrt(SQR(r[0])+SQR(r[1])+SQR(r[2])); + double theta = atan2( sqrt(SQR(r[0])+SQR(r[1])) , r[2] ) ; + double phi = atan2( r[1] , r[0] ) ; + + mat[0][0] = sin(theta) * cos(phi) ; + mat[0][1] = sin(theta) * sin(phi) ; + mat[0][2] = cos(theta) ; + mat[0][3] = 0. ; + mat[1][0] = cos(theta) * cos(phi) ; + mat[1][1] = cos(theta) * sin(phi) ; + mat[1][2] = - sin(theta) ; + mat[1][3] = 0. ; + mat[2][0] = - sin(phi) ; + mat[2][1] = cos(phi) ; + mat[2][2] = 0. ; + mat[2][3] = 0. ; + mat[3][0] = 0. ; + mat[3][1] = 0. ; + mat[3][2] = 0. ; + mat[3][3] = 1.0 ; + + glPushMatrix(); + glTranslated(x[0],y[0],z[0]); + glMultMatrixd(&(mat[0][0])); + glRotated(90., 0, 1, 0); + glScaled(s,s,rn); + //glCallList(listnum); + gluCylinder(qua, 1, 1, 1, CTX.quadric_subdivisions, 1); + glPopMatrix(); +} + +void Draw_Line (int type, double width, double *x, double *y, double *z, + double Raise[3][8]){ + double X[2], Y[2], Z[2]; + + X[0] = x[0]+Raise[0][0]; + Y[0] = y[0]+Raise[1][0]; + Z[0] = z[0]+Raise[2][0]; + + X[1] = x[1]+Raise[0][1]; + Y[1] = y[1]+Raise[1][1]; + Z[1] = z[1]+Raise[2][1]; + + if(type) + Draw_Cylinder(width, X, Y, Z); + else{ + glBegin(GL_LINES); + glVertex3d(X[0], Y[0], Z[0]); + glVertex3d(X[1], Y[1], Z[1]); + glEnd(); + } } void Draw_Triangle (double *x, double *y, double *z, double *n, diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index e19475ea2de8a756aedb4f25d1f4b722d84bf0d6..a6ef36462e07b3ef631852db11c058b3f35f6a4a 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.40 2002-11-08 02:06:59 geuzaine Exp $ +// $Id: Geom.cpp,v 1.41 2002-11-16 08:29:15 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -101,7 +101,7 @@ void Draw_GeoPoint (void *a, void *b){ void Draw_Curve (void *a, void *b){ int i,N; - double mod,dd; + double mod,dd,x[2],y[2],z[2]; char Num[100]; Curve *c; Vertex v,dv; @@ -161,12 +161,23 @@ void Draw_Curve (void *a, void *b){ List_Delete(temp); } else{ - glBegin(GL_LINE_STRIP); - for(i=0;i<N;i++){ - v = InterpolateCurve(c,(double)i/(double)(N-1),0); - glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); + if(CTX.geom.line_type){ + for(i=0;i<N-1;i++){ + v = InterpolateCurve(c,(double)i/(double)(N-1),0); + dv = InterpolateCurve(c,(double)(i+1)/(double)(N-1),0); + x[0] = v.Pos.X; y[0] = v.Pos.Y; z[0] = v.Pos.Z; + x[1] = dv.Pos.X; y[1] = dv.Pos.Y; z[1] = dv.Pos.Z; + Draw_Cylinder(CTX.geom.line_width,x,y,z); + } + } + else{ + glBegin(GL_LINE_STRIP); + for(i=0;i<N;i++){ + v = InterpolateCurve(c,(double)i/(double)(N-1),0); + glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); + } + glEnd(); } - glEnd(); } } @@ -630,8 +641,11 @@ void Draw_Geom (Mesh *m) { Tree_Action(m->Points, Draw_GeoPoint); if(CTX.geom.point_type && !CTX.geom.shade) InitNoShading(); } - if(CTX.geom.lines || CTX.geom.lines_num) + if(CTX.geom.lines || CTX.geom.lines_num){ + if(CTX.geom.line_type) InitShading(); Tree_Action(m->Curves, Draw_Curve ); + if(CTX.geom.line_type && !CTX.geom.shade) InitNoShading(); + } if(CTX.geom.surfaces || CTX.geom.surfaces_num) Tree_Action(m->Surfaces,Draw_Surface); if(CTX.geom.volumes || CTX.geom.volumes_num) diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index 655ad88f11eaad1c8be2af1e45f487987f4d473a..2768be8ea2e67bb15218b9cada50d9520a86e10a 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.3 2002-11-08 03:40:08 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.4 2002-11-16 08:29:15 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -57,7 +57,7 @@ void Draw_ElementBoundary(int type, Post_View *View, double *X, double *Y, doubl Draw_Point(View->PointType,View->PointSize,X,Y,Z,Raise); break; case LINE : - Draw_Line(X,Y,Z,Raise); + Draw_Line(0,View->LineWidth,X,Y,Z,Raise); break; case TRIANGLE : glBegin(GL_LINE_LOOP); @@ -274,12 +274,19 @@ void Draw_ScalarLine(Post_View *View, int preproNormals, if(Val[0] >= ValMin && Val[0] <= ValMax && Val[1] >= ValMin && Val[1] <= ValMax){ - glBegin(GL_LINES); - Palette2(View,ValMin,ValMax,Val[0]); - glVertex3d(X[0]+Raise[0][0], Y[0]+Raise[1][0], Z[0]+Raise[2][0]); - Palette2(View,ValMin,ValMax,Val[1]); - glVertex3d(X[1]+Raise[0][1], Y[1]+Raise[1][1], Z[1]+Raise[2][1]); - glEnd(); + if(View->LineType){ + // not perfect... + Palette2(View,ValMin,ValMax,Val[0]); + Draw_Line(View->LineType,View->LineWidth,X,Y,Z,Raise); + } + else{ + glBegin(GL_LINES); + Palette2(View,ValMin,ValMax,Val[0]); + glVertex3d(X[0]+Raise[0][0], Y[0]+Raise[1][0], Z[0]+Raise[2][0]); + Palette2(View,ValMin,ValMax,Val[1]); + glVertex3d(X[1]+Raise[0][1], Y[1]+Raise[1][1], Z[1]+Raise[2][1]); + glEnd(); + } } else{ //todo @@ -296,7 +303,7 @@ void Draw_ScalarLine(Post_View *View, int preproNormals, ValMin,ValMax,Xp,Yp,Zp,&nb,value); if(nb == 2){ for(i=0;i<2;i++) RaiseFill(i,value[i],ValMin,Raise); - Draw_Line(Xp,Yp,Zp,Raise); + Draw_Line(View->LineType,View->LineWidth,Xp,Yp,Zp,Raise); } } else{ @@ -465,7 +472,7 @@ void Draw_ScalarTriangle(Post_View *View, int preproNormals, thev, ValMin,ValMax,Xp,Yp,Zp,&nb); if(nb == 2){ for(i=0 ; i<2 ; i++) RaiseFill(i,thev,ValMin,Raise); - Draw_Line(Xp,Yp,Zp,Raise); + Draw_Line(View->LineType,View->LineWidth,Xp,Yp,Zp,Raise); } } } @@ -713,16 +720,32 @@ void Draw_VectorElement(int type, Post_View *View, case POINT: Draw_ScalarPoint(View, 0, ValMin, ValMax, Raise, xx, yy, zz, d); if(ts){//draw trajectory - glBegin(GL_LINE_STRIP); - for(j=0 ; j<ts+1 ; j++){ - dx = V[3*(ts-j)]; dy = V[3*(ts-j)+1]; dz = V[3*(ts-j)+2]; - dd = sqrt(dx*dx+dy*dy+dz*dz); - Palette2(View,ValMin,ValMax,dd); - glVertex3d(X[0] + fact*dx + Raise[0][0], - Y[0] + fact*dy + Raise[1][0], - Z[0] + fact*dz + Raise[2][0]); + if(View->LineType){ + double dx2, dy2, dz2, XX[2], YY[2], ZZ[2]; + for(j=0 ; j<ts ; j++){ + dx = V[3*(ts-j)]; dy = V[3*(ts-j)+1]; dz = V[3*(ts-j)+2]; + dx2 = V[3*(ts-j-1)]; dy2 = V[3*(ts-j-1)+1]; dz2 = V[3*(ts-j-1)+2]; + dd = sqrt(dx*dx+dy*dy+dz*dz); + // not perfect... + Palette2(View,ValMin,ValMax,dd); + XX[0] = X[0] + fact*dx; XX[1] = X[1] + fact*dx2; + YY[0] = Y[0] + fact*dy; YY[1] = Y[1] + fact*dy2; + ZZ[0] = Z[0] + fact*dz; ZZ[1] = Z[1] + fact*dz2; + Draw_Line(View->LineType,View->LineWidth,XX,YY,ZZ,Raise); + } + } + else{ + glBegin(GL_LINE_STRIP); + for(j=0 ; j<ts+1 ; j++){ + dx = V[3*(ts-j)]; dy = V[3*(ts-j)+1]; dz = V[3*(ts-j)+2]; + dd = sqrt(dx*dx+dy*dy+dz*dz); + Palette2(View,ValMin,ValMax,dd); + glVertex3d(X[0] + fact*dx + Raise[0][0], + Y[0] + fact*dy + Raise[1][0], + Z[0] + fact*dz + Raise[2][0]); + } + glEnd(); } - glEnd(); } break; case LINE: Draw_ScalarLine(View, 0, ValMin, ValMax, Raise, xx, yy, zz, d); break;