Commit d9814440 authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Branch cut implemented for isosurfaces

parent ba609f8e
......@@ -6,6 +6,8 @@
#include "CutSurfaces.h"
#include <vector>
#define BRANCH_TOL 0.2
class IsoLine {
public:
IsoLine( double v0, double v1, int n, int t ):_v0(v0),_v1(v1),_nl(n),
......@@ -20,7 +22,7 @@ class IsoLine {
int tm(){ return _t; }
void draw( Colourscale *, GLfloat );
void color( const GLfloat* c ){memcpy(_color,c,4*sizeof(GLfloat));}
void branch( bool b, double min=0, double max=0, double tol=0.2 )
void branch( bool b, double min=0, double max=0, double tol=BRANCH_TOL )
{_branch=b;_branch_range[0]=min;_branch_range[1]=max;_branch_tol=tol; }
private:
vector<MultiPoint *> _polygon;
......
......@@ -4,6 +4,8 @@
// project
#include "IsoSurface.h"
#define BRANCH_TOL 0.2
/** constructor
*
* \param m model
......@@ -13,15 +15,31 @@
* \param t time
*/
IsoSurface::IsoSurface(Model* m, DATA_TYPE *dat, double v,
vector<bool>&member, int t)
vector<bool>&member, int t, double *branch )
:_vertnorm(NULL),_vert(NULL),_val(v),_tm(t)
{
double brmin = branch ? branch[0]+BRANCH_TOL*(branch[1]-branch[0]) : 0;
double brmax = branch ? branch[1]-BRANCH_TOL*(branch[1]-branch[0]) : 0;
#pragma omp parallel for schedule(dynamic,100)
for( int i=0; i<m->numVol(); i++ ) {
if( member[i] ) {
// ignore elements crossing the branch cut
if( branch ) {
const int* nodes= m->_vol[i]->obj();
bool low=false, high=false;
for( int n=0; n<m->_vol[i]->ptsPerObj(); n++ ) {
if( dat[nodes[n]] <= brmin ) low=true;
if( dat[nodes[n]] >= brmax ) high=true;
}
if( low && high )
continue;
}
int npoly;
MultiPoint **lpoly = m->_vol[i]->isosurf( dat, _val, npoly );
if (lpoly != NULL){
for( int j=0; j<npoly; j++ )
{
......
......@@ -7,7 +7,7 @@
class IsoSurface {
public:
IsoSurface( Model *, DATA_TYPE *, double, vector<bool>&, int );
IsoSurface( Model *, DATA_TYPE *, double, vector<bool>&, int, double *branch=NULL );
~IsoSurface();
void draw();
GLfloat *color(){ return colour; }
......
......@@ -4,7 +4,7 @@ HDF5API_ROOT := ./hdf5api
FLTK_INC := $(shell fltk-config --use-glut --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-glut --use-gl --ldflags)
COMMON_INC := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX -fopenmp
COMMON_INC := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX #-fopenmp
#HDF5=1
ifdef HDF5
......@@ -25,7 +25,7 @@ endif
COMMON_LIBS = $(FLTK_LIBS) -lpng -lpthread -lm -lz $(LIB_HDF5)
LIBS = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS)
LDFLAGS = -fopenmp
#LDFLAGS = -fopenmp
CXXFLAGS = -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
CPPFLAGS = $(CFLAGS) -g
......
......@@ -419,7 +419,7 @@ void TBmeshWin::draw_iso_surfaces()
}
if( reg->_iso0==NULL )
reg->_iso0 = new IsoSurface( model, data, isosurfwin->isoval0->value(),
reg->ele_membership(), tm );
reg->ele_membership(), tm, _branch_cut?_branch_range:NULL );
reg->_iso0->color( isosurfwin->issColor(0) );
translucency( reg->_iso0->color()[3]<OPAQUE_LIMIT );
......@@ -2045,6 +2045,7 @@ TBmeshWin :: branch_cut(double min, double max, float tol)
_branch_cut = false;
isosurfwin->islDirty(true);
isosurfwin->issDirty(true);
redraw();
}
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