diff --git a/Graphics/Axes.cpp b/Graphics/Axes.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ed63e1c3bf5b167cf63db0746f640e703d8e370 --- /dev/null +++ b/Graphics/Axes.cpp @@ -0,0 +1,122 @@ +/* $Id: Axes.cpp,v 1.1 2000-12-18 08:31:45 geuzaine Exp $ */ + +#include "Gmsh.h" +#include "GmshUI.h" +#include "Const.h" +#include "Mesh.h" +#include "Draw.h" +#include "Context.h" + +extern Context_T CTX; + + +void Draw_Axes (double s) { + double f, g, b, c; + + if(s == 0.) return; + + if(!CTX.range[0] && !CTX.range[1] && !CTX.range[2]) return ; + + f = 0.666 * s; + g = 1.233 * s; + b = .1 * s; + c = 0.666 * b; + + glLineWidth(1.); + glColor4ubv((GLubyte*)&CTX.color.axes); + + glBegin(GL_LINES); + if(CTX.range[2] != 0.){ + /* X */ + glVertex3d(0., 0., 0.); + glVertex3d(s, 0., 0.); + glVertex3d(g-b, b, 0.); + glVertex3d(g+b, -b, 0.); + glVertex3d(g, -b, b); + glVertex3d(g, b, -b); + /* Y */ + glVertex3d(0., 0., 0.); + glVertex3d(0., s, 0.); + glVertex3d(-b, g+b, 0.); + glVertex3d(0., g, 0.); + glVertex3d(0., g, 0.); + glVertex3d(0., g+b, -b); + glVertex3d(0., g, 0.); + glVertex3d(.5*b, g-b, .5*b); + /* Z */ + glVertex3d(0., 0., 0.); + glVertex3d(0., 0., s); + glVertex3d(-b, b, g); + glVertex3d(0., b, g-b); + glVertex3d(0., b, g-b); + glVertex3d(0., -b, g+b); + glVertex3d(0., -b, g+b); + glVertex3d(b, -b, g); + } + else{ + /* X */ + glVertex3d(0., 0., 0.); + glVertex3d(s, 0., 0.); + glVertex3d(g-c, b, 0.); + glVertex3d(g+c, -b, 0.); + glVertex3d(g-c, -b, 0.); + glVertex3d(g+c, b, 0.); + /* Y */ + glVertex3d(0., 0., 0.); + glVertex3d(0., s, 0.); + glVertex3d(-c, g+b, 0.); + glVertex3d(0., g, 0.); + glVertex3d(0., g, 0.); + glVertex3d(c, g+b, 0.); + glVertex3d(0., g, 0.); + glVertex3d(0., g-b, 0.); + } + glEnd(); + + glEnable(GL_LINE_STIPPLE); + glLineStipple(2,0x0F0F); + glBegin(GL_LINES); + if(CTX.range[2] != 0.){ + glVertex3d(f, 0., 0.); + glVertex3d(f, 0., f ); + glVertex3d(f, 0., f ); + glVertex3d(0., 0., f ); + glVertex3d(0., 0., f ); + glVertex3d(0., f, f ); + glVertex3d(0., f, f ); + glVertex3d(0., f, 0.); + } + glVertex3d(0., f, 0.); + glVertex3d(f, f, 0.); + glVertex3d(f, f, 0.); + glVertex3d(f, 0., 0.); + glEnd(); + glDisable(GL_LINE_STIPPLE); + +} + +void Draw_SmallAxes(void){ + double l,o,xx,xy,yx,yy,zx,zy,cx,cy; + + l = 30 ; + o = 2 ; + cx = CTX.viewport[2] - 45; + cy = CTX.viewport[1] + 35; + + xx = l*CTX.rot[0][0] ; xy = l*CTX.rot[0][1] ; + yx = l*CTX.rot[1][0] ; yy = l*CTX.rot[1][1] ; + zx = l*CTX.rot[2][0] ; zy = l*CTX.rot[2][1] ; + + glColor4ubv((GLubyte*)&CTX.color.small_axes); + + glBegin(GL_LINES); + glVertex2d(cx,cy); glVertex2d(cx+xx,cy+xy); + glVertex2d(cx,cy); glVertex2d(cx+yx,cy+yy); + glVertex2d(cx,cy); glVertex2d(cx+zx,cy+zy); + glEnd(); + glRasterPos2d(cx+xx+o,cy+xy+o); Draw_String("X"); + glRasterPos2d(cx+yx+o,cy+yy+o); Draw_String("Y"); + glRasterPos2d(cx+zx+o,cy+zy+o); Draw_String("Z"); + +} + diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 9b099f8e42adb791fb6ae5428dc2c1aa8df74fe8..0954a8e7f74a8f4aa0ff0d1512bbfd7f60e278a1 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -/* $Id: Geom.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */ +/* $Id: Geom.cpp,v 1.6 2000-12-18 08:31:45 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -172,16 +172,14 @@ int isPointOnPlanarSurface (Surface *S, double X, double Y, double Z, double n[3 V.Pos.Z = Z; for(i=0;i<List_Nbr(S->s.Generatrices);i++){ + List_Read(S->s.Generatrices,i,&C); - switch(C->Typ){ - case MSH_SEGM_LINE: + if(C->Typ == MSH_SEGM_LINE) N = 1; - break; - default: + else N = 10; - break; - } + for(j=0;j<N;j++){ u1 = (double)j/(double)(N); u2 = (double)(j+1)/(double)(N); @@ -189,9 +187,11 @@ int isPointOnPlanarSurface (Surface *S, double X, double Y, double Z, double n[3 P2 = InterpolateCurve(C,u2,0); Angle += angle_plan(&V,&P1,&P2,n); } + } - if(fabs(Angle) > 6.0 && fabs(Angle) < 7.)return 1; + if(fabs(Angle) > 6.0 && fabs(Angle) < 7.0) + return 1; return 0; } @@ -209,23 +209,21 @@ void Plan_SurfPlane (void *data,void *dum){ pS = (Surface**)data; s = *pS; + if(s->Typ != MSH_SURF_PLAN) return ; + if(deb){ points = List_Create(10,10,sizeof(Vertex*)); deb = 0; } + else + List_Reset(points); - if(s->Typ == MSH_SURF_PLAN){ - for(i=0;i<List_Nbr(s->s.Generatrices);i++){ - List_Read(s->s.Generatrices,i,&pC); - for(j=0;j<List_Nbr(pC->Control_Points);j++){ - List_Add(points,List_Pointer(pC->Control_Points,j)); - } - } - } - else{ - return; + for(i=0;i<List_Nbr(s->s.Generatrices);i++){ + List_Read(s->s.Generatrices,i,&pC); + for(j=0;j<List_Nbr(pC->Control_Points);j++) + List_Add(points,List_Pointer(pC->Control_Points,j)); } - + N = List_Nbr(points); for(i=0;i<3;i++){ @@ -274,7 +272,6 @@ void Plan_SurfPlane (void *data,void *dum){ s->d = X; res[0] = 1.; res[1] = res[2] = 0.0; - } /* y = Y */ @@ -295,7 +292,7 @@ void Plan_SurfPlane (void *data,void *dum){ /* by + cz = -x */ - else if (!sys3x3(sys,b,res,&det) ){ + else if (!sys3x3_with_tol(sys,b,res,&det) ){ s->d = 0.0; s2s[0][0] = sys[1][1]; s2s[0][1] = sys[1][2]; @@ -382,7 +379,7 @@ void Plan_SurfPlane (void *data,void *dum){ s->invplan[i][j] = s->plan[j][i]; } } - List_Reset(points); + } @@ -394,6 +391,7 @@ void Draw_Plane_Surface (Surface *s){ char Num[100]; if(!s->Orientations){ + s->Orientations = List_Create(20,2,sizeof(Vertex)); Plan_SurfPlane(&s,NULL); k = 0; @@ -406,7 +404,6 @@ void Draw_Plane_Surface (Surface *s){ Projette(&P1,s->plan); Projette(&P2,s->plan); Projette(&P3,s->plan); - if(!k){ k = 1; minx = maxx = P1.Pos.X; @@ -418,21 +415,16 @@ void Draw_Plane_Surface (Surface *s){ maxy = DMAX(DMAX(DMAX(maxy,P1.Pos.Y),P2.Pos.Y),P3.Pos.Y); } - V[0].Pos.X = minx; - V[0].Pos.Y = miny; + V[0].Pos.X = minx; V[0].Pos.Y = miny; + V[1].Pos.X = maxx; V[1].Pos.Y = miny; + V[2].Pos.X = maxx; V[2].Pos.Y = maxy; + V[3].Pos.X = minx; V[3].Pos.Y = maxy; - V[1].Pos.X = maxx; - V[1].Pos.Y = miny; - - V[2].Pos.X = maxx; - V[2].Pos.Y = maxy; - - V[3].Pos.X = minx; - V[3].Pos.Y = maxy; for(i=0;i<4;i++){ V[i].Pos.Z = 0.0; put_Z(&V[i],s); } + n[0] = s->plan[2][0]; n[1] = s->plan[2][1]; n[2] = s->plan[2][2]; @@ -464,7 +456,6 @@ void Draw_Plane_Surface (Surface *s){ k = 0; for(i=0;i<100;i++){ - t = (double)i/(double)(100); vv.Pos.X = t*.5*(V[0].Pos.X+V[3].Pos.X)+(1.-t)*.5*(V[2].Pos.X+V[1].Pos.X); vv.Pos.Y = t*.5*(V[0].Pos.Y+V[3].Pos.Y)+(1.-t)*.5*(V[2].Pos.Y+V[1].Pos.Y); @@ -483,6 +474,7 @@ void Draw_Plane_Surface (Surface *s){ } } if(k)List_Add(s->Orientations,&vv); + Msg(INFO, "Surface %d (%d points)",s->Num,List_Nbr(s->Orientations)); } @@ -495,8 +487,6 @@ void Draw_Plane_Surface (Surface *s){ glEnd(); } - glDisable(GL_LINE_STIPPLE); - if(CTX.geom.surfaces_num){ List_Read(s->Orientations,0,&vv1); List_Read(s->Orientations,1,&vv2); @@ -506,8 +496,9 @@ void Draw_Plane_Surface (Surface *s){ (vv2.Pos.Z+vv1.Pos.Z)/2. + 3*CTX.pixel_equiv_x/CTX.s[2]); Draw_String(Num); } - + if(CTX.geom.normals) { + glDisable(GL_LINE_STIPPLE) ; List_Read(s->Orientations,0,&vv1); List_Read(s->Orientations,1,&vv2); n[0] = s->plan[2][0]; @@ -522,7 +513,6 @@ void Draw_Plane_Surface (Surface *s){ Draw_Vector(DRAW_POST_ARROW, 0, (vv2.Pos.X+vv1.Pos.X)/2., (vv2.Pos.Y+vv1.Pos.Y)/2., (vv2.Pos.Z+vv1.Pos.Z)/2., nn, n[0],n[1],n[2],NULL,NULL); } - } @@ -535,20 +525,17 @@ void Draw_NonPlane_Surface (Surface *s){ int kk; char Num[100]; - u0 =v0= 0; - un =vn= 1; - - if(!s)return; + u0 = v0 = 0; + un = vn = 1; - if((s->Typ == MSH_SURF_NURBS)){ + if(s->Typ == MSH_SURF_NURBS){ NbTics = 5; u0 = s->ku[0]; un = s->ku[s->OrderU + s->Nu]; v0 = s->kv[0]; vn = s->kv[s->OrderV + s->Nv]; - for(i=0;i<NbTics;i++){ + for(i=0;i<NbTics;i++) tics[i] = v0 + ((double)(i+1)/(double)NbTics) * (vn - v0); - } if(CTX.geom.shade){ GLUnurbsObj *nurb; nurb=gluNewNurbsRenderer(); @@ -568,9 +555,6 @@ void Draw_NonPlane_Surface (Surface *s){ tics[0] = 0.5; } - glEnable(GL_LINE_STIPPLE); - - if(CTX.geom.surfaces){ for(kk = 0;kk<NbTics;kk++){ N = 50; @@ -602,10 +586,6 @@ void Draw_NonPlane_Surface (Surface *s){ } } - if(s->Mat){ - glLineWidth(1.); - } - if(CTX.geom.surfaces_num){ v = InterpolateSurface(s,0.5,0.5,0,0); sprintf(Num,"%d",s->Num); @@ -635,7 +615,6 @@ void Draw_NonPlane_Surface (Surface *s){ glColor4ubv((GLubyte*)&CTX.color.geom.normals); Draw_Vector(DRAW_POST_ARROW, 0, n1.Pos.X, n1.Pos.Y, n1.Pos.Z, nn, n[0],n[1],n[2],NULL,NULL); - glEnable(GL_LINE_STIPPLE); } } @@ -645,9 +624,7 @@ void Draw_Surface (void *a, void *b){ s = *(Surface**)a; - if(!s->Support)return; - - if(!EntiteEstElleVisible(s->Num)) return; + if(!s || !s->Support || !EntiteEstElleVisible(s->Num)) return; if(CTX.render_mode == GMSH_SELECT){ glLoadName(2); @@ -662,15 +639,13 @@ void Draw_Surface (void *a, void *b){ else if (Highlighted){ glLineWidth(2.); glColor4ubv((GLubyte*)&CTX.color.geom.surface_hlt); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1,0x0F0F); } else{ glLineWidth(1.); glColor4ubv((GLubyte*)&CTX.color.geom.surface); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1,0x0F0F); } + glEnable(GL_LINE_STIPPLE); + glLineStipple(1,0x0F0F); } else{ ColorSwitch(abs(s->Num)); @@ -687,11 +662,66 @@ void Draw_Surface (void *a, void *b){ if(CTX.render_mode == GMSH_SELECT){ glPopName (); - glDisable(GL_LINE_STIPPLE); } glDisable(GL_LINE_STIPPLE); +} + + +/* ------------------------------------------------------------------------ */ +/* D r a w _ V o l u m e */ +/* ------------------------------------------------------------------------ */ + +int TheVolume; + +void Draw_Curve_For_Volume (void *a, void *b){ + int i,N; + Curve *c; + Vertex v; + + glLineWidth(2.); + + c = *(Curve**)a; + + if(CTX.render_mode == GMSH_SELECT){ + glLoadName(3); + glPushName(TheVolume); + } + + if(c->Typ == MSH_SEGM_LINE) + N = List_Nbr(c->Control_Points); + else + N = 10; + + glBegin(GL_LINE_STRIP); + for(i=0;i<N;i++){ + v = InterpolateCurve(c,0.2*(double)i/(double)(N-1),0); + glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); + } + glEnd(); + + glBegin(GL_LINE_STRIP); + for(i=N-1;i>=0;i--){ + v = InterpolateCurve(c,1.-0.2*(double)i/(double)(N-1),0); + glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); + } + glEnd(); + + + if(CTX.render_mode == GMSH_SELECT){ + glPopName (); + } + + if((c)->ipar[3]){ + glLineWidth(1.); + } + +} + + +void DrawVolumes (Mesh *m){ + } @@ -702,8 +732,6 @@ void Draw_Surface (void *a, void *b){ /* D r a w _ G e o m */ /* ------------------------------------------------------------------------ */ -extern void DrawVolumes (Mesh *m); - void Draw_Geom (Mesh *m) { if(m->status == -1) return; @@ -744,96 +772,6 @@ void ZeroHighlight(Mesh *m){ } -/* ------------------------------------------------------------------------ */ -/* D r a w _ A x e s */ -/* ------------------------------------------------------------------------ */ - -void Draw_Axes (double s) { - double f, g, b, c; - - if(s == 0.) return; - - if(!CTX.range[0] && !CTX.range[1] && !CTX.range[2]) return ; - - f = 0.666 * s; - g = 1.233 * s; - b = .1 * s; - c = 0.666 * b; - - glLineWidth(1.); - glColor4ubv((GLubyte*)&CTX.color.axes); - - glBegin(GL_LINES); - if(CTX.range[2] != 0.){ - /* X */ - glVertex3d(0., 0., 0.); - glVertex3d(s, 0., 0.); - glVertex3d(g-b, b, 0.); - glVertex3d(g+b, -b, 0.); - glVertex3d(g, -b, b); - glVertex3d(g, b, -b); - /* Y */ - glVertex3d(0., 0., 0.); - glVertex3d(0., s, 0.); - glVertex3d(-b, g+b, 0.); - glVertex3d(0., g, 0.); - glVertex3d(0., g, 0.); - glVertex3d(0., g+b, -b); - glVertex3d(0., g, 0.); - glVertex3d(.5*b, g-b, .5*b); - /* Z */ - glVertex3d(0., 0., 0.); - glVertex3d(0., 0., s); - glVertex3d(-b, b, g); - glVertex3d(0., b, g-b); - glVertex3d(0., b, g-b); - glVertex3d(0., -b, g+b); - glVertex3d(0., -b, g+b); - glVertex3d(b, -b, g); - } - else{ - /* X */ - glVertex3d(0., 0., 0.); - glVertex3d(s, 0., 0.); - glVertex3d(g-c, b, 0.); - glVertex3d(g+c, -b, 0.); - glVertex3d(g-c, -b, 0.); - glVertex3d(g+c, b, 0.); - /* Y */ - glVertex3d(0., 0., 0.); - glVertex3d(0., s, 0.); - glVertex3d(-c, g+b, 0.); - glVertex3d(0., g, 0.); - glVertex3d(0., g, 0.); - glVertex3d(c, g+b, 0.); - glVertex3d(0., g, 0.); - glVertex3d(0., g-b, 0.); - } - glEnd(); - - glEnable(GL_LINE_STIPPLE); - glLineStipple(2,0x0F0F); - glBegin(GL_LINES); - if(CTX.range[2] != 0.){ - glVertex3d(f, 0., 0.); - glVertex3d(f, 0., f ); - glVertex3d(f, 0., f ); - glVertex3d(0., 0., f ); - glVertex3d(0., 0., f ); - glVertex3d(0., f, f ); - glVertex3d(0., f, f ); - glVertex3d(0., f, 0.); - } - glVertex3d(0., f, 0.); - glVertex3d(f, f, 0.); - glVertex3d(f, f, 0.); - glVertex3d(f, 0., 0.); - glEnd(); - glDisable(GL_LINE_STIPPLE); - -} - - /* ------------------------------------------------------------------------ */ /* H i g h l i g h t */ /* ------------------------------------------------------------------------ */ diff --git a/Graphics/Makefile b/Graphics/Makefile index 092eff857cfa5ee16e92d42743959a814a98478d..0e5e2cd44425a9075459aa0c44e2add434012ee4 100644 --- a/Graphics/Makefile +++ b/Graphics/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 2000-12-08 10:56:42 geuzaine Exp $ +# $Id: Makefile,v 1.6 2000-12-18 08:31:45 geuzaine Exp $ # # Makefile for "libGraphics.a" # @@ -33,8 +33,9 @@ SRC = Draw.cpp \ Iso.cpp \ Entity.cpp \ Scale.cpp \ - Volume.cpp \ - gl2ps.cpp gl2gif.cpp + Axes.cpp \ + gl2ps.cpp\ + gl2gif.cpp OBJ = $(SRC:.cpp=.o) @@ -116,12 +117,11 @@ Scale.o: Scale.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Draw.h \ ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h gl2ps.h \ ../Unix/XContext.h -Volume.o: Volume.cpp ../Common/Gmsh.h ../Common/Message.h \ +Axes.o: Axes.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ - ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \ - ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \ - ../Geo/ExtrudeParams.h ../Mesh/Metric.h Draw.h ../Common/Views.h \ - ../Common/Const.h ../Common/ColorTable.h ../Mesh/Interpolation.h \ - ../Common/Context.h + ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \ + ../Common/Const.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ + ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Draw.h \ + ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h gl2ps.o: gl2ps.cpp gl2ps.h gl2gif.o: gl2gif.cpp gl2gif.h diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index dedbc874b5d7dbe672a39b49e333696906acdad7..6c21498b13b262c5883fa98a325789ab4cfffdb2 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -/* $Id: Mesh.cpp,v 1.12 2000-12-17 21:17:29 remacle Exp $ */ +/* $Id: Mesh.cpp,v 1.13 2000-12-18 08:31:45 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -422,13 +422,13 @@ void Draw_Simplex_Surfaces (void *a, void *b){ n[1] = m[1] = z1z0 * x2x0 - x1x0 * z2z0 ; n[2] = m[2] = x1x0 * y2y0 - y1y0 * x2x0; // norme(n); not necessary with glEnable(GL_NORMALIZE); - /* BOF BOF BOF */ + /* BOF BOF BOF if(n[2] < -0.1){ n[0] = -n[0]; n[1] = -n[1]; n[2] = -n[2]; } - + */ } if (CTX.mesh.hidden && CTX.mesh.shade){ diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index b251a831c3ffde865d56c524ccad279c8d03d358..c317afec7064f075915de42b41f883db9af80a7f 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -/* $Id: Post.cpp,v 1.7 2000-12-08 12:16:51 geuzaine Exp $ */ +/* $Id: Post.cpp,v 1.8 2000-12-18 08:31:45 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -110,7 +110,10 @@ void Draw_Post (void) { else{ InitNoShading(); } - + + if(v->ShowElement || v->ArrowType == DRAW_POST_DISPLACEMENT) + glEnable(GL_POLYGON_OFFSET_FILL) ; + // force this if(v->IntervalsType == DRAW_POST_CONTINUOUS) glShadeModel(GL_SMOOTH); @@ -264,6 +267,9 @@ void Draw_Post (void) { glEndList(); v->Changed=0; } + + if(v->ShowElement || v->ArrowType == DRAW_POST_DISPLACEMENT) + glDisable(GL_POLYGON_OFFSET_FILL) ; } diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp index 917ee2a074c8d266bb33eb45a7db50983ec6b56e..9ceb31eabd81c9b7967f5fe41d37382794cb1351 100644 --- a/Graphics/PostSimplex.cpp +++ b/Graphics/PostSimplex.cpp @@ -1,4 +1,4 @@ -/* $Id: PostSimplex.cpp,v 1.5 2000-11-27 10:58:54 geuzaine Exp $ */ +/* $Id: PostSimplex.cpp,v 1.6 2000-12-18 08:31:45 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -21,10 +21,9 @@ void Draw_ScalarPoint(Post_View *View, d = V[View->TimeStep]; if(d>=ValMin && d<=ValMax){ + RaiseFill(0, d, ValMin, Raise); Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d)); - glBegin(GL_POINTS); - glVertex3d(X[0], Y[0], Z[0]); - glEnd(); + Draw_Point(X,Y,Z,View->Offset,Raise); } } @@ -35,6 +34,7 @@ void Draw_VectorPoint(Post_View *View, double d,dx,dy,dz,fact; if(View->ArrowType == DRAW_POST_DISPLACEMENT){ + fact = View->ArrowScale/100. ; glColor4ubv((GLubyte*)&CTX.color.fg); glBegin(GL_POINTS); @@ -50,32 +50,30 @@ void Draw_VectorPoint(Post_View *View, fact*V[3*(View->TimeStep-i)+2]); glEnd(); } + } else{ + dx = V[3*View->TimeStep]; dy = V[3*View->TimeStep+1]; dz = V[3*View->TimeStep+2]; d = sqrt(dx*dx+dy*dy+dz*dz); if(d!=0.0 && d>=ValMin && d<=ValMax){ - Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d)); - fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ; - if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){ dx /= d ; dy /= d ; dz /= d ; d = log10(d/ValMin) ; dx *= d ; dy *= d ; dz *= d ; } - RaiseFill(0, d, ValMin, Raise); - Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO, X[0], Y[0], Z[0], fact*d, fact*dx, fact*dy, fact*dz, View->Offset, Raise); } + } } @@ -97,20 +95,22 @@ void Draw_ScalarLine(Post_View *View, double Xp[5],Yp[5],Zp[5],value[5],thev; char Num[100] ; - if(View->IntervalsType==DRAW_POST_NUMERIC){ + if(View->IntervalsType == DRAW_POST_NUMERIC){ + d = (V[2*View->TimeStep]+V[2*View->TimeStep+1]) / 2.; if(d >= ValMin && d <= ValMax){ + RaiseFill(0, d, ValMin, Raise); + Palette2(View,ValMin,ValMax,d); sprintf(Num, "%g", d); - glColor4ubv((GLubyte*)&CTX.color.fg); glRasterPos3d((X[0] + X[1])/2., (Y[0] + Y[1])/2., (Z[0] + Z[1])/2.); Draw_String(Num); } + } else{ - glDisable(GL_LINE_STIPPLE); for(k=0 ; k<2 ; k++) RaiseFill(k, V[2*View->TimeStep+k], ValMin, Raise); if(View->IntervalsType==DRAW_POST_CONTINUOUS){ @@ -228,25 +228,37 @@ void Draw_ScalarTriangle(Post_View *View, double Xp[5],Yp[5],Zp[5],value[5],thev; char Num[100] ; - if(View->ShowElement) - glEnable(GL_POLYGON_OFFSET_FILL); - if(View->IntervalsType==DRAW_POST_NUMERIC){ + if(View->IntervalsType == DRAW_POST_NUMERIC){ + d = (V[3*View->TimeStep]+V[3*View->TimeStep+1]+V[3*View->TimeStep+2]) / 3.; if(d >= ValMin && d <= ValMax){ sprintf(Num, "%g", d); - glColor4ubv((GLubyte*)&CTX.color.fg); - glRasterPos3d((X[0] + X[1] + X[2])/3., - (Y[0] + Y[1] + Y[2])/3., - (Z[0] + Z[1] + Z[2])/3.); + RaiseFill(0, d, ValMin, Raise); + Palette2(View,ValMin,ValMax,d); + glRasterPos3d((X[0] + X[1] + X[2])/3.+Raise[0][0], + (Y[0] + Y[1] + Y[2])/3.+Raise[1][0], + (Z[0] + Z[1] + Z[2])/3.+Raise[2][0]); Draw_String(Num); } + } else{ - if(View->IntervalsType!=DRAW_POST_ISO) - for(i=0;i<3;i++)RaiseFill(i, V[3*View->TimeStep+i], ValMin, Raise); + if(View->ShowElement || + View->IntervalsType == DRAW_POST_CONTINUOUS) + for(i = 0 ; i<3 ; i++) RaiseFill(i, V[3*View->TimeStep+i], ValMin, Raise); + if(View->ShowElement){ + glColor4ubv((GLubyte*)&CTX.color.fg); + glBegin(GL_LINE_LOOP); + for(i=0 ; i<3 ; i++) + glVertex3d(X[i]+View->Offset[0]+Raise[0][i], + Y[i]+View->Offset[1]+Raise[1][i], + Z[i]+View->Offset[2]+Raise[2][i]); + glEnd(); + } + if(View->Light){ x1x0 = (X[1]+Raise[0][1]) - (X[0]+Raise[0][0]); y1y0 = (Y[1]+Raise[1][1]) - (Y[0]+Raise[1][0]); @@ -257,18 +269,10 @@ void Draw_ScalarTriangle(Post_View *View, nn[0] = y1y0 * z2z0 - z1z0 * y2y0 ; nn[1] = z1z0 * x2x0 - x1x0 * z2z0 ; nn[2] = x1x0 * y2y0 - y1y0 * x2x0 ; - //norme(nn); unnecessary with glEnable(GL_NORMALIZE); - /* BOF BOF BOF - if(nn[2] < -0.1){ - nn[0] = -nn[0]; - nn[1] = -nn[1]; - nn[2] = -nn[2]; - } - */ glNormal3dv(nn); } - if(View->IntervalsType==DRAW_POST_CONTINUOUS){ + if(View->IntervalsType == DRAW_POST_CONTINUOUS){ if(V[3*View->TimeStep] >=ValMin && V[3*View->TimeStep] <=ValMax && V[3*View->TimeStep+1]>=ValMin && V[3*View->TimeStep+1]<=ValMax && V[3*View->TimeStep+2]>=ValMin && V[3*View->TimeStep+2]<=ValMax){ @@ -293,7 +297,7 @@ void Draw_ScalarTriangle(Post_View *View, Xp,Yp,Zp,&nb,value); if(nb >= 3){ glBegin(GL_POLYGON); - for(i=0;i<nb;i++){ + for(i=0 ; i<nb ; i++){ Palette2(View,ValMin,ValMax,value[i]); RaiseFill(i,value[i],ValMin,Raise); glVertex3d(Xp[i]+View->Offset[0]+Raise[0][i], @@ -306,7 +310,7 @@ void Draw_ScalarTriangle(Post_View *View, } else{ for(k=0 ; k<View->NbIso ; k++){ - if(View->IntervalsType==DRAW_POST_DISCRETE){ + if(View->IntervalsType == DRAW_POST_DISCRETE){ Palette(View,View->NbIso,k); CutTriangle2D(X,Y,Z,&V[3*View->TimeStep], View->GVFI(ValMin,ValMax,View->NbIso+1,k), @@ -314,18 +318,17 @@ void Draw_ScalarTriangle(Post_View *View, ValMin,ValMax, Xp,Yp,Zp,&nb,value); if(nb >= 3){ - for(i=0;i<nb;i++) RaiseFill(i,value[i],ValMin,Raise); + for(i=0 ; i<nb ; i++) RaiseFill(i,value[i],ValMin,Raise); Draw_Polygon(nb,Xp,Yp,Zp,View->Offset,Raise); } } else{ Palette(View,View->NbIso,k); - thev = View->GVFI(ValMin,ValMax,View->NbIso,k); CutTriangle1D(X,Y,Z,&V[3*View->TimeStep], thev, ValMin,ValMax,Xp,Yp,Zp,&nb); if(nb == 2){ - for(i=0;i<2;i++) RaiseFill(i,thev,ValMin,Raise); + for(i=0 ; i<2 ; i++) RaiseFill(i,thev,ValMin,Raise); Draw_Line(Xp,Yp,Zp,View->Offset,Raise); } } @@ -334,38 +337,24 @@ void Draw_ScalarTriangle(Post_View *View, } - if(View->ShowElement){ - glDisable(GL_POLYGON_OFFSET_FILL) ; - glColor4ubv((GLubyte*)&CTX.color.fg); - glBegin(GL_LINE_LOOP); - for(i=0 ; i<3 ; i++) - glVertex3d(X[i]+View->Offset[0]+Raise[0][i], - Y[i]+View->Offset[1]+Raise[1][i], - Z[i]+View->Offset[2]+Raise[2][i]); - glEnd(); - } - } void Draw_VectorTriangle(Post_View *View, double ValMin, double ValMax, double Raise[3][5], double *X, double *Y, double *Z, double *V){ - int i, k, m; + int k, m; double d,dx,dy,dz,fact; double xx[3],yy[3],zz[3]; - if(View->ShowElement) - glEnable(GL_POLYGON_OFFSET_FILL); - if(View->ArrowType == DRAW_POST_DISPLACEMENT){ + fact = View->ArrowScale/100. ; - for(m=0;m<3;m++){ + for(m=0 ; m<3 ; m++){ xx[m] = X[m] + fact * V[9*View->TimeStep + 3 * m ]; yy[m] = Y[m] + fact * V[9*View->TimeStep + 3 * m + 1]; zz[m] = Z[m] + fact * V[9*View->TimeStep + 3 * m + 2]; } - glEnable(GL_POLYGON_OFFSET_FILL); glColor4ubv((GLubyte*)&CTX.color.bg); if(View->IntervalsType!=DRAW_POST_ISO) Draw_Polygon (3, xx, yy, zz, View->Offset, Raise); @@ -373,7 +362,7 @@ void Draw_VectorTriangle(Post_View *View, glBegin(GL_LINE_LOOP); for(m=0 ; m<3 ; m++) glVertex3d(xx[m], yy[m], zz[m]); glEnd(); - glDisable(GL_POLYGON_OFFSET_FILL); + } else{ @@ -426,17 +415,6 @@ void Draw_VectorTriangle(Post_View *View, } - if(View->ShowElement){ - glDisable(GL_POLYGON_OFFSET_FILL) ; - glColor4ubv((GLubyte*)&CTX.color.fg); - glBegin(GL_LINE_LOOP); - for(i=0 ; i<3 ; i++) - glVertex3d(X[i]+View->Offset[0]+Raise[0][i], - Y[i]+View->Offset[1]+Raise[1][i], - Z[i]+View->Offset[2]+Raise[2][i]); - glEnd(); - } - } void Draw_TensorTriangle(Post_View *View, diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp index e4c13e361c4122bb909933da84f2ece4a90b54b6..90e650c3750bc78c43d014d7c075662889079cf1 100644 --- a/Graphics/Scale.cpp +++ b/Graphics/Scale.cpp @@ -1,4 +1,4 @@ -/* $Id: Scale.cpp,v 1.8 2000-12-10 00:06:50 geuzaine Exp $ */ +/* $Id: Scale.cpp,v 1.9 2000-12-18 08:31:45 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -26,7 +26,7 @@ extern XContext_T XCTX; extern List_T *Post_ViewList; /* ------------------------------------------------------------------------ */ -/* D r a w _ S c a l e */ +/* D r a w _ S t r i n g */ /* ------------------------------------------------------------------------ */ void Draw_String(char *s){ @@ -55,6 +55,10 @@ static XCharStruct overall; #endif +/* ------------------------------------------------------------------------ */ +/* D r a w _ S c a l e */ +/* ------------------------------------------------------------------------ */ + extern double GiveValueFromIndex_Lin(double ValMin, double ValMax, int NbIso, int Iso); extern double GiveValueFromIndex_Log(double ValMin, double ValMax, int NbIso, int Iso); extern int GiveIndexFromValue_Lin(double ValMin, double ValMax, int NbIso, double Val); @@ -281,33 +285,3 @@ void Draw_Scales(void){ } - -/* ------------------------------------------------------------------------ */ -/* D r a w _ S m a l l A x e s */ -/* ------------------------------------------------------------------------ */ - -void Draw_SmallAxes(void){ - double l,o,xx,xy,yx,yy,zx,zy,cx,cy; - - l = 30 ; - o = 2 ; - cx = CTX.viewport[2] - 45; - cy = CTX.viewport[1] + 35; - - xx = l*CTX.rot[0][0] ; xy = l*CTX.rot[0][1] ; - yx = l*CTX.rot[1][0] ; yy = l*CTX.rot[1][1] ; - zx = l*CTX.rot[2][0] ; zy = l*CTX.rot[2][1] ; - - glColor4ubv((GLubyte*)&CTX.color.small_axes); - - glBegin(GL_LINES); - glVertex2d(cx,cy); glVertex2d(cx+xx,cy+xy); - glVertex2d(cx,cy); glVertex2d(cx+yx,cy+yy); - glVertex2d(cx,cy); glVertex2d(cx+zx,cy+zy); - glEnd(); - glRasterPos2d(cx+xx+o,cy+xy+o); Draw_String("X"); - glRasterPos2d(cx+yx+o,cy+yy+o); Draw_String("Y"); - glRasterPos2d(cx+zx+o,cy+zy+o); Draw_String("Z"); - -} - diff --git a/Graphics/Volume.cpp b/Graphics/Volume.cpp deleted file mode 100644 index c38f2e04162066c43c5f7c28b974aca1d5d553f1..0000000000000000000000000000000000000000 --- a/Graphics/Volume.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* $Id: Volume.cpp,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */ - -#include "Gmsh.h" -#include "GmshUI.h" -#include "Geo.h" -#include "Mesh.h" -#include "Draw.h" -#include "Interpolation.h" -#include "Context.h" - -extern Context_T CTX; - -int TheVolume; - -extern Mesh *THEM; - -void Draw_Curve_For_Volume (void *a, void *b){ - int i,N; - Curve *c; - Vertex v; - - glLineWidth(2.); - - c = *(Curve**)a; - - if(CTX.render_mode == GMSH_SELECT){ - glLoadName(3); - glPushName(TheVolume); - } - - if(c->Typ == MSH_SEGM_LINE) - N = List_Nbr(c->Control_Points); - else - N = 10; - - glBegin(GL_LINE_STRIP); - for(i=0;i<N;i++){ - v = InterpolateCurve(c,0.2*(double)i/(double)(N-1),0); - glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); - } - glEnd(); - - glBegin(GL_LINE_STRIP); - for(i=N-1;i>=0;i--){ - v = InterpolateCurve(c,1.-0.2*(double)i/(double)(N-1),0); - glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); - } - glEnd(); - - - if(CTX.render_mode == GMSH_SELECT){ - glPopName (); - } - - if((c)->ipar[3]){ - glLineWidth(1.); - } - -} - - -void DrawVolumes (Mesh *m){ - - -} - - -