Commit 215fe61f authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Fixed restoring isosurfaces.

Input values of isosurfaces and data extremes are only recognized after
hitting enter or losing focus. Removes annoying and slow changes while
inputting into the text field.

Added const to defintion in Myslider to remove warning when compiling
trimesh.cc.

Changed draw routine so isisurfaces are shaded. The isovalue tables need
to be fixed so normals are consistent.

Renamed DrawingObj.cc to match the header DrawingObjects.h.

Updated the manual.
parent b8c8de09
......@@ -19,9 +19,9 @@ static const int simple_index[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13};
float find_line_plane_intersect( const GLfloat* a, const GLfloat* b,
const GLfloat* pc, GLfloat* ip )
{
float d1 = fabs(dot( a, pc )+pc[3]);
float d2 = fabs(dot( b, pc )+pc[3]);
float t = d1/(d1+d2);
float d1 = dot( a, pc )+pc[3];
float d2 = dot( b, pc )+pc[3];
float t = d1/(d1-d2);
GLfloat v[3];
add( a, scale( sub(b,a,v), t ), ip );
......
......@@ -27,7 +27,7 @@ void IsoSurface::draw()
{
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
for( int i=0; i<polygon.size(); i++ ) {
polygon[i]->draw(0, colour, 1 );
polygon[i]->draw(0, 0, colour, NULL, NULL );
}
}
......@@ -29,7 +29,7 @@ OBJS = Fl_Gl_Tb_Window.o\
Connection.o\
CutSurfaces.o\
DataOpacity.o\
DrawingObj.o\
DrawingObjects.o\
FileType.o\
gl2ps.o\
Graph.o PlotWin.o plottingwin.o\
......
......@@ -21,7 +21,7 @@
const int w_valout = 40;
Myslider :: Myslider( int X, int Y, int W, int H, char *L):
Myslider :: Myslider( int X, int Y, int W, int H, const char *L):
Fl_Group(X,Y,W,H,L),
valout(X,Y,w_valout,H),
slider( X+w_valout, Y, W-w_valout, H )
......
......@@ -30,7 +30,7 @@ class Myslider : public Fl_Group
Fl_Slider slider;
Fl_Value_Output valout;
public:
Myslider( int, int, int, int, char *L=0 );
Myslider( int, int, int, int, const char *L=0 );
int handle( int );
float value( void );
void value( int );
......
......@@ -397,7 +397,7 @@ void TBmeshWin::draw_iso_surfaces()
if( reg->_iso0==NULL )
reg->_iso0 = new IsoSurface( model, data, isosurfwin->isoval0->value(),
reg->ele_membership(), tm );
reg->_iso0->color( isosurfwin->color(0) );
reg->_iso0->color( isosurfwin->issColor(0) );
reg->_iso0->draw();
}
......
......@@ -17,7 +17,7 @@ class IsosurfControl {open
Function {IsosurfControl(TBmeshWin *tb)} {open
} {
Fl_Window isowin {open
xywh {746 82 305 270} type Double visible
xywh {799 25 305 270} type Double visible
} {
Fl_Group {} {
label {Isosurface 0} open
......@@ -45,7 +45,7 @@ if(fl_color_chooser( "Isosurface 0",r,g,b ) ){
callback {_issDirty = true;
if( isoOn0->value() )
mwtb->redraw();}
xywh {177 44 70 28}
xywh {177 44 70 28} when 8
}
Fl_Value_Slider opacity0 {
label {Opacity:}
......@@ -67,18 +67,18 @@ if( isoOn0->value() )
label {start value:}
callback {_islDirty = true;
if( isolineOn->value() ) mwtb->redraw();}
xywh {220 161 60 29}
xywh {220 161 60 29} when 4
}
Fl_Value_Input isolineVal1 {
label {end value:}
callback {_islDirty = true;
if( isolineOn->value() ) mwtb->redraw();}
xywh {220 191 60 29}
xywh {220 191 60 29} when 4
}
Fl_Spinner isoNumLines {
label {\#lines:}
callback {_islDirty = true;
if( isolineOn->value() ) mwtb->redraw();}
if( isolineOn->value() ) mwtb->redraw();} selected
xywh {220 221 60 24} value 1
}
Fl_Spinner isolineThick {
......@@ -113,18 +113,26 @@ _islColor[3] = 1.;
_issDirty = true;} {}
}
decl {TBmeshWin* mwtb;} {}
decl {GLfloat _color0[4];} {selected
}
decl {GLfloat _color0[4];} {}
decl {GLfloat _islColor[4];} {}
decl {int isosurfT;} {}
decl {int isolineT;} {}
decl {bool _islDirty;} {}
decl {bool _issDirty;} {}
Function {color(int s)} {return_type {const GLfloat*}
Function {issColor(int s)} {return_type {const GLfloat*}
} {
code {if( s==0 ) {
_color0[3] = opacity0->value();
return _color0;
}} {}
}
Function {issColor(int s,float r, float g, float b, float a)} {return_type void
} {
code {if( s==0 ) {
_color0[0] = r;
_color0[1] = g;
_color0[2] = b;
_color0[3] = a;
}} {}
}
Function {islDirty()} {return_type bool
......
......@@ -48,7 +48,7 @@ grid, as well as examining the structure of the grid.
It is an ever changing and ongoing project that has been in development since 2001.
Certain file schemes and names may bear a vague resemblance to those used by
\emph{Cool Graphics}, a program developed by Jamey Eason, but it's only because he
thought too loudly when he was in the beside me in the office.
thought too loudly when he was beside me in the office.
\section{Input Files}
......@@ -88,7 +88,7 @@ Surfaces are independent of regions, and the relationship between the points
and model structures is described in the Fig.~\ref{fig:UML}.
\begin{figure}
\centerline{\includegraphics[width=13cm]{UML}}
\caption{Relationshop between vertces (Points) and other structures.}
\caption{Relationshop between vertices (Points) and other structures.}
\label{fig:UML}
\end{figure}
......@@ -389,7 +389,7 @@ Currently, the first 2 are ignored but must be present.
\section{Invocation}
The program is run by typing\\[1ex]
\centerline{
{\texttt{meshalyzer cg\_in|[pts [vpts] [dat|tdat|out] [tri tri ...]]
{\texttt{meshalyzer cg\_in|[pts [vpts] [dat|tdat|out] [mshz] [tri ...]]
\raisebox{-2Ex}{\rule{0em}{3Ex}}
}}}\\
where the extensions of the required file types are given.
......@@ -407,18 +407,20 @@ This only applies to the vertices file.
\caption{The control widget.}
\end{figure}
\subsection{Tetrahedral Mesh}
To display the tetrahedral mesh, click on the \emph{Tetrahedral Mesh}
\subsection{Volume Mesh}
To display the volume element mesh, click on the \emph{Voxele Mesh}
radio button in the
\emph{Display as:} box.
The colour of the tetrahedra can be changed with the \emph{Tet colour} button.
The colour of the volume elements can be changed with the \emph{Voxele colour}
button.
No other structure types will be displayed.
\subsection{Regions}
To not display the mesh as a set of tetrahedra, click on the \emph{Surfaces}
To not display the mesh as a set of volume elements,
click on the \emph{Surfaces}
radio button in the
\emph{Display as:} box.
This will display all structures except tetrahedra.
This will display all structures except volume elements.
Display of each structure type can be toggled on and off on a
region-by-region basis or all-at-once.
......@@ -434,9 +436,13 @@ order.
The order can be reversed by checking ``Reverse Draw order'' under the ``Image''
menu.
For each structure, there is a button toggling its display, a button to select its
colour when it is not displaying data, and a
input widget for selecting the output stride.
For each structure, there is a button toggling its display,
and a button to select its dispaly properties.
pressing the ``props'' button will open a widget to specify
colour when it is not displaying data, to specify the output stride, size
and if a 3D effect is to be used.
Note that the 3D effect is graphics intensive and may be very slow for a
large number of structures.
Different structures in different layers can be coloured differently.
Under ``Image/Randomly colour'', one can select which structure types gets randomly
......@@ -650,6 +656,23 @@ For each clipping plane, several different modes are available:
\caption{Clipping plane dialogue.}
\end{figure}
\subsubsection{IsoSurfaces/IsoLines}
By selecting ``Isosurf'' from the ``Data'' menu item,
the isosurface/isolines widget is popped open.
This widget controls display of isovalue surfaces and lines.
Isosurfaces are only available if elements are defined.
They are drawn with a specified colour and opacity.
Changes to the ``value'' are reflected when enter is pressed or the focus
changes.
For isolines, surfaces must be defined. An initial isovalue, ending
isovalue and the number of isovalue lines are specified.
If ``datified'' is selected, the lines are coloured according to
the data colour scale, otherwise all lines are drawn with the same
specified ``colour''.
The thickness of the lines can also be controlled.
\subsection{Output Menu}
\subsubsection{Single Images}
......@@ -721,6 +744,19 @@ Standard views are available under the ``Image'' menu under ``View''.
The normal which points directly out of (+) or into (-) the screen is
first selected and then the positive direction of the other axes.
\subsection{Saving/Restoring the State}
The state is everything including the view transform.
You can save the state under ``Save state'' in the ``File'' menu.
You will be prompted for a file which will have the extension \emph{.mshz}.
This file is text and can be edited by hand afterwards.
You may delete any entries which you do not wish restored.
Upon invoking \meshal from the command line, your home directory will be
searched for a default state file called \texttt{.default.mshz}
which will be read in automatically.
A state file can also be specified on the command line and will supercede
any default settings.
\section{Grid window}
The grid is displayed in a window which has a virtual trackball.
......
......@@ -55,9 +55,10 @@ winny->size_range(50,50,1200,1200,5,5,1);} {}
class Controls {open
} {
Function {Controls()} {} {
Function {Controls()} {open
} {
Fl_Window window {
label {Meshalyzer Controls}
label {Meshalyzer Controls} open
xywh {359 50 350 650} type Double box UP_BOX
code0 {\#include <FL/Fl_Color_Chooser.h>}
code1 {\#include "VecData.h"} visible
......@@ -622,7 +623,7 @@ op->win->show();}
xywh {10 270 330 215} align 0
} {
Fl_Group hilightgrp {
label Highlight
label Highlight selected
xywh {10 305 330 170} labelfont 1 labelsize 12 labelcolor 121 align 4
} {
Fl_Value_Input tethi {
......@@ -1010,7 +1011,7 @@ refresh_surflist();}
}
}
}
Fl_Group colorscalegrp {
Fl_Group colorscalegrp {open
xywh {10 490 330 60} box ENGRAVED_BOX
} {
Fl_Button {} {
......@@ -1061,19 +1062,19 @@ mwtb->redraw();}
label min
callback {mwtb->cs->calibrate(o->value(),mwtb->cs->max());
mwtb->redraw();}
xywh {65 500 65 25} labelsize 10 align 2 textsize 12
xywh {65 500 65 25} labelsize 10 align 2 when 4 textsize 12
}
Fl_Value_Input maxcolval {
label max
callback {mwtb->cs->calibrate(mwtb->cs->min(),o->value());
mwtb->redraw();}
xywh {130 500 65 25} labelsize 10 align 2 textsize 12
xywh {130 500 65 25} labelsize 10 align 2 when 4 textsize 12
}
Fl_Value_Input numcolev {
label levels
callback {mwtb->cs->size((int)(o->value()));
mwtb->redraw();}
tooltip {colourmap size} xywh {195 500 30 25} labelsize 10 align 2 minimum 4 maximum 252 step 1 value 64 textsize 12
tooltip {colourmap size} xywh {195 500 30 25} labelsize 10 align 2 when 4 minimum 4 maximum 252 step 1 value 64 textsize 12
}
Fl_Light_Button autocalibratebut {
label auto
......@@ -1327,11 +1328,9 @@ SAVE_WIDGET( mshzf, mwtb->isosurfwin->isolineOn );
SAVE_WIDGET( mshzf, mwtb->isosurfwin->isoOn0 );
SAVE_WIDGET( mshzf, mwtb->isosurfwin->isoval0 );
SAVE_WIDGET( mshzf, mwtb->isosurfwin->opacity0 );
SAVE_WIDGET( mshzf, mwtb->isosurfwin->isocol0 );
mshzf << "ISOSURF0 COLOUR = ";
save_colour( mshzf, mwtb->isosurfwin->color(0) );
mshzf << endl;} {selected
}
mshzf << "ISOSURF_COLOUR 0 = ";
save_colour( mshzf, mwtb->isosurfwin->issColor(0) );
mshzf << endl;} {}
}
Function {save_colour( ofstream&ofs, const GLfloat *col )} {} {
code {for( int c=0; c<3; c++ ) ofs << col[c] << " ";
......@@ -1367,6 +1366,8 @@ if( fname==NULL ) {
int BUFLEN=1024;
char buf[BUFLEN];
float r, g, b, a;
while( mshzf.getline( buf, BUFLEN ) ) {
float val;
......@@ -1391,7 +1392,6 @@ while( mshzf.getline( buf, BUFLEN ) ) {
mshzf.getline(var, 1024);
continue;
}
float r,g,b,a;
mshzf >> r >> g >> b >> a;
mwtb->model->surface(i)->fillcolor(r,g,b,a);
mshzf >> r >> g >> b >> a;
......@@ -1404,7 +1404,6 @@ while( mshzf.getline( buf, BUFLEN ) ) {
continue;
}
if( !strcmp( var, "REGION_COLOURS" ) ) {
float r, g, b, a;
bool v;
for( int i=0; i<val; i++ ) {
if( i >= mwtb->model->_numReg ) {
......@@ -1519,12 +1518,19 @@ while( mshzf.getline( buf, BUFLEN ) ) {
TEST_VAR( mwtb->isosurfwin->isolineThick, var, int(val) )
TEST_VAR( mwtb->isosurfwin->islDatify, var, int(val) )
TEST_VAR( mwtb->isosurfwin->isolineOn, var, int(val) )
TEST_VAR( mwtb->isosurfwin->isoval0, var, val )
TEST_VAR( mwtb->isosurfwin->opacity0, var, val )
TEST_VAR( mwtb->isosurfwin->isoOn0, var, val )
if( !strcmp( var, "ISOLINE_COLOUR" ) ){
float r, g, b, a;
sscanf( buf, "%*s = %f %f %f %f", &r, &g, &b, &a );
sscanf( buf, "%*s = %d %f %f %f %f", &r, &g, &b, &a );
mwtb->isosurfwin->islColor(r,g,b,a);
continue;
}
if( !strcmp( var, "ISOSURF_COLOUR" ) ){
sscanf( buf, "%*s %*d = %f %f %f %f", &r, &g, &b, &a );
mwtb->isosurfwin->issColor(int(val),r,g,b,a);
continue;
}
if( !strcmp( "BGD_COLOUR", var )) { mwtb->bgd(val); continue; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment