Skip to content
Snippets Groups Projects
Commit 94022ba9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

new drawing cide complete (except for LCM tensor stuff--needs to be rethought
anyway)

need testing
parent d545c4cf
No related branches found
No related tags found
No related merge requests found
// $Id: Post.cpp,v 1.121 2007-08-27 23:33:28 geuzaine Exp $ // $Id: Post.cpp,v 1.122 2007-08-28 07:03:42 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -794,9 +794,7 @@ void addVectorElement(PView *p, int iele, int numNodes, int numEdges, ...@@ -794,9 +794,7 @@ void addVectorElement(PView *p, int iele, int numNodes, int numEdges,
for(int i = 0; i < numNodes; i++){ for(int i = 0; i < numNodes; i++){
double norm = normValue(3, val[i]); double norm = normValue(3, val[i]);
double norm2 = normValue(numComp2, val2[i]); double norm2 = normValue(numComp2, val2[i]);
if(norm && opt->TmpMax && if(norm2 >= opt->ExternalMin && norm2 <= opt->ExternalMax){
norm2 >= opt->ExternalMin &&
norm2 <= opt->ExternalMax){
unsigned int color = opt->getColor(norm2, opt->ExternalMin, opt->ExternalMax); unsigned int color = opt->getColor(norm2, opt->ExternalMin, opt->ExternalMax);
unsigned int col[2] = {color, color}; unsigned int col[2] = {color, color};
double dxyz[3][2]; double dxyz[3][2];
...@@ -828,10 +826,9 @@ void addVectorElement(PView *p, int iele, int numNodes, int numEdges, ...@@ -828,10 +826,9 @@ void addVectorElement(PView *p, int iele, int numNodes, int numEdges,
// need epsilon since we compare computed results (the average) // need epsilon since we compare computed results (the average)
// instead of the raw data used to compute bounds // instead of the raw data used to compute bounds
double eps = 1.e-15; const double eps = 1.e-15;
if(norm && opt->TmpMax && if(norm2 >= opt->ExternalMin * (1. - eps) &&
norm2 >= opt->ExternalMin * (1. - 1.e-15) && norm2 <= opt->ExternalMax * (1. + eps)){
norm2 <= opt->ExternalMax * (1. + 1.e-15)){
unsigned int color = opt->getColor(norm2, opt->ExternalMin, opt->ExternalMax); unsigned int color = opt->getColor(norm2, opt->ExternalMin, opt->ExternalMax);
unsigned int col[2] = {color, color}; unsigned int col[2] = {color, color};
double dxyz[3][2]; double dxyz[3][2];
...@@ -950,7 +947,6 @@ void drawArrays(PView *p, VertexArray *va, GLint type, bool useNormalArray) ...@@ -950,7 +947,6 @@ void drawArrays(PView *p, VertexArray *va, GLint type, bool useNormalArray)
else else
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
Msg(DEBUG, "%d verts in varray", va->getNumVertices());
glDrawArrays(type, 0, va->getNumVertices()); glDrawArrays(type, 0, va->getNumVertices());
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
...@@ -972,6 +968,7 @@ void drawVectorArray(PView *p, VertexArray *va) ...@@ -972,6 +968,7 @@ void drawVectorArray(PView *p, VertexArray *va)
float *v = va->getVertexArray(3 * (i + 1)); float *v = va->getVertexArray(3 * (i + 1));
glColor4ubv((GLubyte *)va->getColorArray(4 * i)); glColor4ubv((GLubyte *)va->getColorArray(4 * i));
double norm = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); double norm = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
if(norm && opt->TmpMax){
double f = CTX.pixel_equiv_x / CTX.s[0] * opt->ArrowSize / double f = CTX.pixel_equiv_x / CTX.s[0] * opt->ArrowSize /
(opt->ArrowSizeProportional ? opt->TmpMax : norm); (opt->ArrowSizeProportional ? opt->TmpMax : norm);
Draw_Vector(opt->VectorType, opt->IntervalsType != PViewOptions::Iso, Draw_Vector(opt->VectorType, opt->IntervalsType != PViewOptions::Iso,
...@@ -980,6 +977,7 @@ void drawVectorArray(PView *p, VertexArray *va) ...@@ -980,6 +977,7 @@ void drawVectorArray(PView *p, VertexArray *va)
v[0] * f, v[1] * f, v[2] * f, opt->Light); v[0] * f, v[1] * f, v[2] * f, opt->Light);
} }
} }
}
std::string stringValue(int numComp, double d[9], double norm, char *format) std::string stringValue(int numComp, double d[9], double norm, char *format)
{ {
...@@ -1041,9 +1039,8 @@ void drawNormalVectorGlyphs(PView *p, int numNodes, double xyz[NMAX][3], ...@@ -1041,9 +1039,8 @@ void drawNormalVectorGlyphs(PView *p, int numNodes, double xyz[NMAX][3],
SVector3 n = normal3(xyz); SVector3 n = normal3(xyz);
n.normalize(); n.normalize();
n[0] *= opt->Normals * CTX.pixel_equiv_x / CTX.s[0]; for(int i = 0; i < 3; i++)
n[1] *= opt->Normals * CTX.pixel_equiv_x / CTX.s[1]; n[i] *= opt->Normals * CTX.pixel_equiv_x / CTX.s[i];
n[2] *= opt->Normals * CTX.pixel_equiv_x / CTX.s[2];
glColor4ubv((GLubyte *) & opt->color.normals); glColor4ubv((GLubyte *) & opt->color.normals);
Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius,
CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius,
...@@ -1060,9 +1057,8 @@ void drawTangentVectorGlyphs(PView *p, int numNodes, double xyz[NMAX][3], ...@@ -1060,9 +1057,8 @@ void drawTangentVectorGlyphs(PView *p, int numNodes, double xyz[NMAX][3],
SVector3 pc = 0.5 * (p0 + p1); SVector3 pc = 0.5 * (p0 + p1);
SVector3 t(p0, p1); SVector3 t(p0, p1);
t.normalize(); t.normalize();
t[0] *= opt->Tangents * CTX.pixel_equiv_x / CTX.s[0]; for(int i = 0; i < 3; i++)
t[1] *= opt->Tangents * CTX.pixel_equiv_x / CTX.s[1]; t[i] *= opt->Tangents * CTX.pixel_equiv_x / CTX.s[i];
t[2] *= opt->Tangents * CTX.pixel_equiv_x / CTX.s[2];
glColor4ubv((GLubyte *) & opt->color.tangents); glColor4ubv((GLubyte *) & opt->color.tangents);
Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius,
CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius,
......
// $Id: PViewOptions.cpp,v 1.7 2007-08-27 17:51:25 geuzaine Exp $ // $Id: PViewOptions.cpp,v 1.8 2007-08-28 07:03:42 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -56,7 +56,7 @@ PViewOptions::PViewOptions() ...@@ -56,7 +56,7 @@ PViewOptions::PViewOptions()
Tangents = 0.; Tangents = 0.;
Visible = 1; Visible = 1;
IntervalsType = Continuous; IntervalsType = Continuous;
IntervalsType = Discrete; //IntervalsType = Discrete;
IntervalsType = Iso; IntervalsType = Iso;
//IntervalsType = Numeric; //IntervalsType = Numeric;
NbIso = 15; NbIso = 15;
...@@ -80,9 +80,9 @@ PViewOptions::PViewOptions() ...@@ -80,9 +80,9 @@ PViewOptions::PViewOptions()
DrawTetrahedra = DrawHexahedra = DrawPrisms = DrawPyramids = DrawTetrahedra = DrawHexahedra = DrawPrisms = DrawPyramids =
DrawScalars = DrawVectors = DrawTensors = 1; DrawScalars = DrawVectors = DrawTensors = 1;
Boundary = 0; Boundary = 0;
PointType = LineType = 0; PointType = LineType = 2;
PointSize = 3; PointSize = 3;
LineWidth = 1; LineWidth = 3;
UseStipple = 0; UseStipple = 0;
ExternalViewIndex = ViewIndexForGenRaise = -1; ExternalViewIndex = ViewIndexForGenRaise = -1;
UseGenRaise = 0; UseGenRaise = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment