diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 0cddea8b1d8292278cd16d46b554a1594ec39556..4c90ab2c76954fa363573e38a8f6bfcb00358ef7 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -42,9 +42,10 @@ void set_r(int i, double val); void set_t(int i, double val); void set_s(int i, double val); -void RaiseFill (int i, double Val, double ValMin, double Raise[3][8]); -void Palette1 (Post_View * View, int nbi, int i); -void Palette2 (Post_View * View, double min, double max, double val); +void RaiseFill(int i, double Val, double ValMin, double Raise[3][8]); +void Palette(Post_View * View, double min, double max, double val); +void Palette1(Post_View * View, int nbi, int i); +void Palette2(Post_View * v, double min, double max, double val); void ColorSwitch(int i); int SelectEntity(int type, Vertex **v, Curve **c, Surface **s); @@ -60,27 +61,27 @@ void DrawUI(void); void Draw(void); void Draw_String(char *s); -void Draw_Geom (Mesh *m); +void Draw_Geom(Mesh *m); void Draw_Mesh(Mesh *M); void Draw_Post(void); void Draw_Graph2D(void); void Draw_Text2D(void); void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc); void Draw_Scales(void); -void Draw_Axes (double s); +void Draw_Axes(double s); void Draw_SmallAxes(void); void Draw_Sphere(double size, double x, double y, double z, int light); -void Draw_Cylinder (double width, double *x, double *y, double *z, int light); +void Draw_Cylinder(double width, double *x, double *y, double *z, int light); void Draw_Point(int type, double size, double *x, double *y, double *z, double Raise[3][8], int light); -void Draw_Line (int type, double width, double *x, double *y, double *z, double Raise[3][8], int light); -void Draw_Triangle (double *x, double *y, double *z,double *n, - double Raise[3][8], int light); -void Draw_Quadrangle (double *x, double *y, double *z, double *n, - double Raise[3][8], int light); -void Draw_Vector (int Type, int Fill, - double relHeadRadius, double relStemLength, double relStemRadius, - double x, double y, double z, double dx, double dy, double dz, - double Raise[3][8], int light); +void Draw_Line(int type, double width, double *x, double *y, double *z, double Raise[3][8], int light); +void Draw_Triangle(double *x, double *y, double *z,double *n, + double Raise[3][8], int light); +void Draw_Quadrangle(double *x, double *y, double *z, double *n, + double Raise[3][8], int light); +void Draw_Vector(int Type, int Fill, + double relHeadRadius, double relStemLength, double relStemRadius, + double x, double y, double z, double dx, double dy, double dz, + double Raise[3][8], int light); void Draw_Mesh_Volumes(void *a, void *b); void Draw_Mesh_Surfaces(void *a, void *b); @@ -88,14 +89,14 @@ void Draw_Mesh_Extruded_Surfaces(void *a, void *b); void Draw_Mesh_Curves(void *a, void *b); void Draw_Mesh_Points(void *a, void *b); -void Draw_Simplex_Volume (void *a, void *b); -void Draw_Simplex_Surface (void *a, void *b); -void Draw_Simplex_Surface_Simple (void *a, void *b); +void Draw_Simplex_Volume(void *a, void *b); +void Draw_Simplex_Surface(void *a, void *b); +void Draw_Simplex_Surface_Simple(void *a, void *b); void Draw_Simplex_Curves(void *a,void *b); -void Draw_Hexahedron_Volume (void *a, void *b); -void Draw_Prism_Volume (void *a, void *b); -void Draw_Pyramid_Volume (void *a, void *b); +void Draw_Hexahedron_Volume(void *a, void *b); +void Draw_Prism_Volume(void *a, void *b); +void Draw_Pyramid_Volume(void *a, void *b); void Draw_ScalarPoint(Post_View *View, int preproNormals, double ValMin, double ValMax, double Raise[3][8], @@ -170,4 +171,11 @@ void Draw_TensorPyramid(Post_View *View, double ValMin, double ValMax, double Raise[3][8], double *X, double *Y, double *Z, double *V); +double GiveValueFromIndex_Lin(double ValMin, double ValMax, int NbIso, int Iso); +double GiveValueFromIndex_Log(double ValMin, double ValMax, int NbIso, int Iso); +double GiveValueFromIndex_DoubleLog(double ValMin, double ValMax, int NbIso, int Iso); +int GiveIndexFromValue_Lin(double ValMin, double ValMax, int NbIso, double Val); +int GiveIndexFromValue_Log(double ValMin, double ValMax, int NbIso, double Val); +int GiveIndexFromValue_DoubleLog(double ValMin, double ValMax, int NbIso, double Val); + #endif diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index f63a6edaf35d8881389a7db39b6394384999edd9..d1c13a9fe47d91b1438c1c677194444f46e27546 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.53 2004-04-20 01:26:13 geuzaine Exp $ +// $Id: Post.cpp,v 1.54 2004-04-20 18:14:31 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -36,24 +36,21 @@ static double RaiseFactor[3]; // Give Value from Index -double GiveValueFromIndex_Lin(double ValMin, double ValMax, int NbIso, - int Iso) +double GiveValueFromIndex_Lin(double ValMin, double ValMax, int NbIso, int Iso) { if(NbIso == 1) return (ValMax + ValMin) / 2.; return ValMin + Iso * (ValMax - ValMin) / (NbIso - 1.); } -double GiveValueFromIndex_Log(double ValMin, double ValMax, int NbIso, - int Iso) +double GiveValueFromIndex_Log(double ValMin, double ValMax, int NbIso, int Iso) { if(NbIso == 1) return (ValMax + ValMin) / 2.; if(ValMin <= 0.) return 0.; - return pow(10., - log10(ValMin) + Iso * (log10(ValMax) - log10(ValMin)) / (NbIso - - 1.)); + return pow(10., log10(ValMin) + + Iso * (log10(ValMax) - log10(ValMin)) / (NbIso - 1.)); } double GiveValueFromIndex_DoubleLog(double ValMin, double ValMax, int NbIso, @@ -67,9 +64,8 @@ double GiveValueFromIndex_DoubleLog(double ValMin, double ValMax, int NbIso, double Iso2 = Iso / 2.; double NbIso2 = NbIso / 2.; - return pow(10., - log10(ValMin) + Iso2 * (log10(ValMax) - - log10(ValMin)) / (NbIso2 - 1.)); + return pow(10., log10(ValMin) + + Iso2 * (log10(ValMax) - log10(ValMin)) / (NbIso2 - 1.)); } // Give Index From Value @@ -96,6 +92,7 @@ int GiveIndexFromValue_Log(double ValMin, double ValMax, int NbIso, int GiveIndexFromValue_DoubleLog(double ValMin, double ValMax, int NbIso, double Val) { + // JF: this is obviously wrong... if(ValMin == ValMax) return NbIso / 2; if(ValMin <= 0.) @@ -107,6 +104,12 @@ int GiveIndexFromValue_DoubleLog(double ValMin, double ValMax, int NbIso, // Color Palette +void Palette(Post_View * v, double min, double max, double val) +{ /* val in [min,max] */ + int index = v->GIFV(min, max, v->CT.size, val); + glColor4ubv((GLubyte *) & v->CT.table[index]); +} + void Palette1(Post_View * v, int nbi, int i) { /* i in [0,nbi-1] */ int index; diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index ec0fe8a7a73bb472c67e6a4e307b5925e6206d67..f4042f924d6fad91cf86961043e22dbcc86b5443 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.24 2004-04-20 01:26:14 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.25 2004-04-20 18:14:31 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -255,7 +255,7 @@ void Draw_ScalarPoint(Post_View * View, int preproNormals, Draw_ElementBoundary(POINT, View, X, Y, Z, Raise); if(d >= ValMin && d <= ValMax) { - Palette2(View, ValMin, ValMax, d); + Palette(View, ValMin, ValMax, d); if(View->IntervalsType == DRAW_POST_NUMERIC) { glRasterPos3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]); @@ -302,7 +302,7 @@ void Draw_ScalarLine(Post_View * View, int preproNormals, d = (Val[0] + Val[1]) / 2.; if(d >= ValMin && d <= ValMax) { - Palette2(View, ValMin, ValMax, d); + Palette(View, ValMin, ValMax, d); sprintf(Num, View->Format, d); glRasterPos3d((X[0] + Raise[0][0] + X[1] + Raise[0][1]) / 2., (Y[0] + Raise[1][0] + Y[1] + Raise[1][1]) / 2., @@ -319,15 +319,15 @@ void Draw_ScalarLine(Post_View * View, int preproNormals, Val[1] >= ValMin && Val[1] <= ValMax) { if(View->LineType) { // not perfect... - Palette2(View, ValMin, ValMax, Val[0]); + Palette(View, ValMin, ValMax, Val[0]); Draw_Line(View->LineType, View->LineWidth, X, Y, Z, Raise, View->Light); } else { glBegin(GL_LINES); - Palette2(View, ValMin, ValMax, Val[0]); + Palette(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]); + Palette(View, ValMin, ValMax, Val[1]); glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]); glEnd(); @@ -454,7 +454,7 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, d = (Val[0] + Val[1] + Val[2]) / 3.; if(d >= ValMin && d <= ValMax) { - Palette2(View, ValMin, ValMax, d); + Palette(View, ValMin, ValMax, d); sprintf(Num, View->Format, d); glRasterPos3d((X[0] + Raise[0][0] + X[1] + Raise[0][1] + X[2] + Raise[0][2]) / 3., @@ -476,15 +476,15 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, Val[1] >= ValMin && Val[1] <= ValMax && Val[2] >= ValMin && Val[2] <= ValMax) { glBegin(GL_TRIANGLES); - Palette2(View, ValMin, ValMax, Val[0]); + Palette(View, ValMin, ValMax, Val[0]); glNormal3dv(&norms[0]); glVertex3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]); - Palette2(View, ValMin, ValMax, Val[1]); + Palette(View, ValMin, ValMax, Val[1]); glNormal3dv(&norms[3]); glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]); - Palette2(View, ValMin, ValMax, Val[2]); + Palette(View, ValMin, ValMax, Val[2]); glNormal3dv(&norms[6]); glVertex3d(X[2] + Raise[0][2], Y[2] + Raise[1][2], Z[2] + Raise[2][2]); @@ -495,8 +495,8 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, if(nb >= 3) { glBegin(GL_POLYGON); for(i = 0; i < nb; i++) { - Palette2(View, ValMin, ValMax, value[i]); - RaiseFill(i, value[i], ValMin, Raise); + Palette(View, ValMin, ValMax, value[i]); + RaiseFill(i, value[i], ValMin, Raise); glVertex3d(Xp[i] + Raise[0][i], Yp[i] + Raise[1][i], Zp[i] + Raise[2][i]); } @@ -506,8 +506,8 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, } else { for(k = 0; k < View->NbIso; k++) { + Palette1(View, View->NbIso, k); if(View->IntervalsType == DRAW_POST_DISCRETE) { - Palette1(View, View->NbIso, k); CutTriangle2D(X, Y, Z, Val, View->GVFI(ValMin, ValMax, View->NbIso + 1, k), View->GVFI(ValMin, ValMax, View->NbIso + 1, k + 1), @@ -523,7 +523,6 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, } } else { - Palette1(View, View->NbIso, k); thev = View->GVFI(ValMin, ValMax, View->NbIso, k); CutTriangle1D(X, Y, Z, Val, thev, Xp, Yp, Zp, &nb); if(nb == 2) { @@ -581,7 +580,7 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals, d = 0.25 * (Val[0] + Val[1] + Val[2] + Val[3]); if(d >= ValMin && d <= ValMax) { - Palette2(View, ValMin, ValMax, d); + Palette(View, ValMin, ValMax, d); sprintf(Num, View->Format, d); glRasterPos3d(0.25 * (X[0] + Raise[0][0] + X[1] + Raise[0][1] + X[2] + Raise[0][2] + X[3] + Raise[0][3]), @@ -833,7 +832,7 @@ void Draw_VectorElement(int type, Post_View * View, dz2 = V[3 * (ts - j - 1) + 2]; dd = sqrt(dx * dx + dy * dy + dz * dz); // not perfect... - Palette2(View, ValMin, ValMax, dd); + Palette(View, ValMin, ValMax, dd); XX[0] = X[0] + fact * dx; XX[1] = X[0] + fact * dx2; YY[0] = Y[0] + fact * dy; @@ -850,7 +849,7 @@ void Draw_VectorElement(int type, Post_View * View, 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); + Palette(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]); @@ -907,10 +906,12 @@ void Draw_VectorElement(int type, Post_View * View, dd = sqrt(dx * dx + dy * dy + dz * dz); // allow for some roundoff error due to the computation at the barycenter - if(dd != 0.0 && dd >= ValMin * (1. - 1.e-15) - && dd <= ValMax * (1. + 1.e-15)) { - Palette1(View, View->NbIso, - View->GIFV(ValMin, ValMax, View->NbIso, dd)); + if(dd != 0.0 && dd >= ValMin * (1. - 1.e-15) && dd <= ValMax * (1. + 1.e-15)) { + if(View->IntervalsType == DRAW_POST_CONTINUOUS) + Palette(View, ValMin, ValMax, dd); + else + Palette1(View, View->NbIso, + View->GIFV(ValMin, ValMax, View->NbIso, dd)); if(View->IntervalsType == DRAW_POST_NUMERIC) { glRasterPos3d(xc, yc, zc); sprintf(Num, View->Format, dd); @@ -938,8 +939,11 @@ void Draw_VectorElement(int type, Post_View * View, else { for(k = 0; k < nbnod; k++) { if(d[k] != 0.0 && d[k] >= ValMin && d[k] <= ValMax) { - Palette1(View, View->NbIso, - View->GIFV(ValMin, ValMax, View->NbIso, d[k])); + if(View->IntervalsType == DRAW_POST_CONTINUOUS) + Palette(View, ValMin, ValMax, d[k]); + else + Palette1(View, View->NbIso, + View->GIFV(ValMin, ValMax, View->NbIso, d[k])); fact = CTX.pixel_equiv_x / CTX.s[0] * View->ArrowSize / ValMax; if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin > 0) { Val[k][0] /= d[k]; diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp index 202ab37f4012b7b77066f36d30038569c40ff8b0..a5fb3fc109347d1599f1e060c1352cd1351293e5 100644 --- a/Graphics/Scale.cpp +++ b/Graphics/Scale.cpp @@ -1,4 +1,4 @@ -// $Id: Scale.cpp,v 1.39 2004-04-19 22:54:42 geuzaine Exp $ +// $Id: Scale.cpp,v 1.40 2004-04-20 18:14:31 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -33,15 +33,6 @@ extern Context_T CTX; // Even if all computations in these routines are made in window // coordinates, double precision is used to work at subpixel accuracy -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); -extern int GiveIndexFromValue_Log(double ValMin, double ValMax, int NbIso, - double Val); - void draw_scale(Post_View * v, double xmin, double ymin, double width, double height, double tic, double space, double dx, double dy) @@ -107,6 +98,10 @@ void draw_scale(Post_View * v, v->GIFV = GiveIndexFromValue_Log; v->GVFI = GiveValueFromIndex_Log; break; + case DRAW_POST_DOUBLELOGARITHMIC: + v->GIFV = GiveIndexFromValue_DoubleLog; + v->GVFI = GiveValueFromIndex_DoubleLog; + break; } // colorscale diff --git a/doc/VERSIONS b/doc/VERSIONS index aab19b008c7ae3db42f16b1e97ee65b02846bbc9..55ec2f6eae6a70016dcb1784105651bd0fbd94a3 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,16 +1,16 @@ -$Id: VERSIONS,v 1.195 2004-04-19 21:59:14 geuzaine Exp $ +$Id: VERSIONS,v 1.196 2004-04-20 18:14:31 geuzaine Exp $ New in 1.52: new raster ("bitmap") PostScript/EPS/PDF output formats; new Plugin(Extract) to extract a given component from a post-processing view; improved mesh projection on non-planar surfaces; added support for second order tetrahedral elements; added interactive control of element order; refined mesh entity drawing selection (and -renamed most of the corresponding options); add fine grained control -various bug fixes (default postscript printing mode, drawing of 3D -arrows/cylinders on Linux, default home directory on Windows, default -initial file browser directory, extrusion of points with -non-normalized axes of rotation, computation of the scene bounding box -in scripts, + the usual documentation updates); +renamed most of the corresponding options); enhanced log scale in +post-processing; various bug fixes (default postscript printing mode, +drawing of 3D arrows/cylinders on Linux, default home directory on +Windows, default initial file browser directory, extrusion of points +with non-normalized axes of rotation, computation of the scene +bounding box in scripts, + the usual documentation updates); New in 1.51: initial support for visualizing mesh partitions; integrated version 2.0 of the MSH mesh file format; new option to