Commit 571bbfb5 authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Fixed intercept issue when the normals are flipped.

parent fa01f51c
......@@ -23,7 +23,7 @@ class ClipPlane {open
} {
Fl_Window window {
label {Clipping Plane} open
xywh {863 23 575 495} type Double visible
xywh {863 23 575 805} type Double visible
} {
Fl_Group Clip0 {
label {Clipping Plane 1} open
......@@ -62,7 +62,7 @@ normcb(0);}
}
Fl_Value_Slider intercept0 {
label Intercept
callback {normcb(0);} selected
callback {normcb(0);}
tooltip {control intercept of plane with axes} xywh {145 25 25 195} selection_color 10 minimum -1
}
Fl_Choice dispas0 {
......@@ -257,11 +257,11 @@ tbmw->redraw();}
}
}
Fl_Group Clip3 {
label {Clipping Plane 4}
label {Clipping Plane 4} open
xywh {5 250 185 220} box UP_BOX align 2
} {
Fl_Group {} {
label {Plane Normal4}
label {Plane Normal4} open
xywh {15 305 115 145} box UP_BOX
} {
Fl_Value_Input xdir3 {
......@@ -487,6 +487,16 @@ tbmw->redraw();}
}
}
}
Fl_Box cporient {
label label
xywh {140 579 130 97} box UP_BOX color 17
code0 {\#include "Orienter.h"}
class Orienter
}
Fl_Return_Button {} {
label button
xywh {245 630 66 20}
}
}
code {tbmw = tb;
dim = 1;
......@@ -529,7 +539,7 @@ else if( cp==4 )
else if( cp==5 )
return dispas5->value()>0;} {}
}
Function {plane(int cp)} {open return_type {GLdouble*}
Function {plane(int cp)} {return_type {GLdouble*}
} {
code {return x[cp];} {}
}
......@@ -539,6 +549,7 @@ else if( cp==5 )
x[cp][0] = xdir0->value();
x[cp][1] = ydir0->value();
x[cp][2] = zdir0->value();
calc_intercept(cp);
x[cp][3] = intercept0->value()*dim+ctr_intercept[0];
if( drawIntercept(0) ) tbmw->determine_cutplane( 0 );
if( dispas0->value()>0 ) tbmw->redraw();
......@@ -546,6 +557,7 @@ else if( cp==5 )
x[cp][0] = xdir1->value();
x[cp][1] = ydir1->value();
x[cp][2] = zdir1->value();
calc_intercept(cp);
x[cp][3] = intercept1->value()*dim+ctr_intercept[1];
if( drawIntercept(1) ) tbmw->determine_cutplane( 1 );
if( dispas1->value()>0 ) tbmw->redraw();
......@@ -553,6 +565,7 @@ else if( cp==5 )
x[cp][0] = xdir2->value();
x[cp][1] = ydir2->value();
x[cp][2] = zdir2->value();
calc_intercept(cp);
x[cp][3] = intercept2->value()*dim+ctr_intercept[2];
if( drawIntercept(2) ) tbmw->determine_cutplane( 2 );
if( dispas2->value()>0 ) tbmw->redraw();
......@@ -560,6 +573,7 @@ else if( cp==5 )
x[cp][0] = xdir3->value();
x[cp][1] = ydir3->value();
x[cp][2] = zdir3->value();
calc_intercept(cp);
x[cp][3] = intercept3->value()*dim+ctr_intercept[3];
if( drawIntercept(3) ) tbmw->determine_cutplane( 3 );
if( dispas3->value()>0 ) tbmw->redraw();
......@@ -567,6 +581,7 @@ else if( cp==5 )
x[cp][0] = xdir4->value();
x[cp][1] = ydir4->value();
x[cp][2] = zdir4->value();
calc_intercept(cp);
x[cp][3] = intercept4->value()*dim+ctr_intercept[4];
if( drawIntercept(4) ) tbmw->determine_cutplane( 4 );
if( dispas4->value()>0 ) tbmw->redraw();
......@@ -574,6 +589,7 @@ else if( cp==5 )
x[cp][0] = xdir5->value();
x[cp][1] = ydir5->value();
x[cp][2] = zdir5->value();
calc_intercept(cp);
x[cp][3] = intercept5->value()*dim+ctr_intercept[5];
if( drawIntercept(5) ) tbmw->determine_cutplane( 5 );
if( dispas5->value()>0 ) tbmw->redraw();
......@@ -608,7 +624,7 @@ else if( cp==4 )
else if( cp==5 )
return dispas5->value()==2;} {}
}
Function {flip(int cp)} {private return_type void
Function {flip(int cp)} {open private return_type void
} {
code {if( cp==0 ) {
xdir0->value(-xdir0->value());
......@@ -643,11 +659,11 @@ else if( cp==5 )
}
normcb(cp);} {}
}
Function {drawIntercept( int cp, bool b )} {open private
Function {drawIntercept( int cp, bool b )} {private
} {
code {intercept[cp] = b;} {}
}
Function {drawIntercept( int cp )} {open return_type bool
Function {drawIntercept( int cp )} {return_type bool
} {
code {return intercept[cp];} {}
}
......@@ -698,14 +714,18 @@ CHECK_CP(3);
CHECK_CP(4);
CHECK_CP(5);} {}
}
Function {calc_intercept()} {open
Function {calc_intercepts()} {open
} {
code {for( int i=0; i<6; i++ ){
const GLfloat* ctr = tbmw->model->pt_offset();
ctr_intercept[i] = -(ctr[0]*x[i][0]+ctr[1]*x[i][1]+ctr[2]*x[i][2]);
calc_intercept(i);
normcb(i);
}} {}
}
Function {calc_intercept( int i )} {open selected private
} {
code {const GLfloat* ctr = tbmw->model->pt_offset();
ctr_intercept[i] = -(ctr[0]*x[i][0]+ctr[1]*x[i][1]+ctr[2]*x[i][2]);} {}
}
}
decl {\#include <iostream>} {private local
......
......@@ -18,7 +18,7 @@ endif
COMMON_LIBS = -lpng -lpthread -lm -lz $(LIB_HDF5)
LIBS = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS)
LDFLAGS = -L$(HDF5API_ROOT)/lib
LDFLAGS =
CXXFLAGS = -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
CPPFLAGS = $(CFLAGS) -g
......@@ -32,10 +32,10 @@ OBJS = $(FLTK_SOURCES:.fl=.o)\
$(patsubst %.c,%.o,$(wildcard *.c))\
$(patsubst %.C,%.o,$(wildcard *.C))
all: meshalyzer $(LIB_CH5)
all: meshalyzer
meshalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OBJS) $(LIB_CH5)
$(CXX) $(CFLAGS) -o meshalyzer $(sort $(OBJS)) $(LIBS)
$(CXX) $(LDFLAGS) -o meshalyzer $(sort $(OBJS)) $(LIBS)
fltk-config --post meshalyzer
ifdef HDF5
......
......@@ -1090,6 +1090,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget )
}
}
redraw();
Fl::check();
Fl::flush();
write_frame( foutname, w(), h(), this );
}
......
This diff is collapsed.
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2009 C. Geuzaine
* Copyright (C) 1999-2011 C. Geuzaine
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of either:
......@@ -27,7 +27,9 @@
* library in the file named "COPYING.GL2PS"; if not, I will be glad
* to provide one.
*
* For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
* For the latest info about gl2ps and a full list of contributors,
* see http://www.geuz.org/gl2ps/.
*
* Please report all bugs and problems to <gl2ps@geuz.org>.
*/
......@@ -42,6 +44,7 @@
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# if defined(_MSC_VER)
# pragma warning(disable:4115)
# pragma warning(disable:4996)
# endif
# include <windows.h>
# if defined(GL2PSDLL)
......@@ -77,14 +80,14 @@
#define GL2PS_MAJOR_VERSION 1
#define GL2PS_MINOR_VERSION 3
#define GL2PS_PATCH_VERSION 3
#define GL2PS_PATCH_VERSION 6
#define GL2PS_EXTRA_VERSION ""
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
0.01 * GL2PS_MINOR_VERSION + \
0.0001 * GL2PS_PATCH_VERSION)
#define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine"
#define GL2PS_COPYRIGHT "(C) 1999-2011 C. Geuzaine"
/* Output file formats (the values and the ordering are important!) */
......@@ -136,9 +139,9 @@
#define GL2PS_BLEND 4
/* Text alignment (o=raster position; default mode is BL):
+---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
| o | o | | o | | | | | | | | | | | |
+---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
+---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
| o | o | | o | | | | | | | | | | | |
+---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
C CL CR B BL BR T TL TR */
#define GL2PS_TEXT_C 1
......@@ -157,10 +160,10 @@ typedef GLfloat GL2PSrgba[4];
extern "C" {
#endif
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
GLint viewport[4], GLint format, GLint sort,
GLint options, GLint colormode,
GLint colorsize, GL2PSrgba *colormap,
GLint colorsize, GL2PSrgba *colormap,
GLint nr, GLint ng, GLint nb, GLint buffersize,
FILE *stream, const char *filename);
GL2PSDLL_API GLint gl2psEndPage(void);
......@@ -168,9 +171,9 @@ GL2PSDLL_API GLint gl2psSetOptions(GLint options);
GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
GL2PSDLL_API GLint gl2psEndViewport(void);
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
GLshort fontsize);
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
GLshort fontsize, GLint align, GLfloat angle);
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
......
......@@ -283,7 +283,7 @@ main( int argc, char *argv[] )
win.trackballwin->get_data(argv[i], control.tmslider );
}
win.trackballwin->cplane->calc_intercept();
win.trackballwin->cplane->calc_intercepts();
win.trackballwin->show();
for ( int i=0; i<win.trackballwin->model->numSurf(); i++ ) {
......
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