diff --git a/Common/Context.h b/Common/Context.h index c221ccba97db9ecfedc34af8141a9ef67a7aa89e..ec302470af1cbc4a4f3abc06e489b510199f34d0 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -174,7 +174,7 @@ public : int histogram, initial_only; double normals, tangents, explode; int color_carousel ; - int use_cut_plane, cut_plane_as_surface; + int use_cut_plane, cut_plane_as_surface, cut_plane_only_volume; double cut_planea,cut_planeb,cut_planec,cut_planed; double evalCutPlane (double x, double y, double z){ double val = cut_planea * x + cut_planeb * y + cut_planec * z + cut_planed; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index d4a2fa9b85b6e34b62099bed031ba0525459afb9..54bda6242e67cf3099c0737a69125799d876b5dc 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -723,6 +723,8 @@ StringXNumber MeshOptions_Number[] = { "Enable mesh cut plane" }, { F, "CutPlaneAsSurface" , opt_mesh_cut_plane_as_surface , 0 , "Draw the intersection volume layer as a surface" }, + { F, "CutPlaneOnlyVolume" , opt_mesh_cut_plane_only_volume , 0 , + "Cut only the volume elements" }, { F, "CutPlaneA" , opt_mesh_cut_planea , 1. , "First cut plane equation coefficient (`A' in `AX+BY+CZ+D=0')" }, { F, "CutPlaneB" , opt_mesh_cut_planeb , 0. , diff --git a/Common/Options.cpp b/Common/Options.cpp index ae7a7100e370e7bac1671e6a36f869e928d1bd4d..7770ed07d3f811dcb9b72ff04185630d2e67c7b6 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.173 2004-07-22 05:47:45 geuzaine Exp $ +// $Id: Options.cpp,v 1.174 2004-07-23 01:28:57 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -3780,6 +3780,19 @@ double opt_mesh_cut_plane_as_surface(OPT_ARGS_NUM) return CTX.mesh.cut_plane_as_surface; } +double opt_mesh_cut_plane_only_volume(OPT_ARGS_NUM) +{ + if(action & GMSH_SET){ + if(CTX.mesh.cut_plane_only_volume != (int)val) CTX.mesh.changed = 1; + CTX.mesh.cut_plane_only_volume = (int)val; + } +#if defined(HAVE_FLTK) + if(WID && (action & GMSH_GUI)) + WID->mesh_butt[23]->value(CTX.mesh.cut_plane_only_volume); +#endif + return CTX.mesh.cut_plane_only_volume; +} + double opt_mesh_cut_planea(OPT_ARGS_NUM) { if(action & GMSH_SET){ diff --git a/Common/Options.h b/Common/Options.h index 473bff696009f23c44d2fefaefa11a202bdf4ae9..5de90160e3eb74a40b4773c232561ab8e790c771 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -383,6 +383,7 @@ double opt_mesh_dual(OPT_ARGS_NUM); double opt_mesh_interactive(OPT_ARGS_NUM); double opt_mesh_use_cut_plane(OPT_ARGS_NUM); double opt_mesh_cut_plane_as_surface(OPT_ARGS_NUM); +double opt_mesh_cut_plane_only_volume(OPT_ARGS_NUM); double opt_mesh_cut_planea(OPT_ARGS_NUM); double opt_mesh_cut_planeb(OPT_ARGS_NUM); double opt_mesh_cut_planec(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 96425c6a2a7c6ecbc4130b542c0ab7b4d7cd1aae..cbaeb50f00268da02282beecbec6ec4fbb1378ab 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.257 2004-07-22 05:47:45 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.258 2004-07-23 01:28:57 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -978,6 +978,7 @@ void mesh_options_ok_cb(CALLBACK_ARGS) opt_mesh_volumes_num(0, GMSH_SET, WID->mesh_butt[15]->value()); opt_mesh_use_cut_plane(0, GMSH_SET, WID->mesh_butt[16]->value()); opt_mesh_cut_plane_as_surface(0, GMSH_SET, WID->mesh_butt[22]->value()); + opt_mesh_cut_plane_only_volume(0, GMSH_SET, WID->mesh_butt[23]->value()); opt_mesh_light(0, GMSH_SET, WID->mesh_butt[17]->value()); opt_mesh_light_two_side(0, GMSH_SET, WID->mesh_butt[18]->value()); opt_mesh_smooth_normals(0, GMSH_SET, WID->mesh_butt[19]->value()); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 71a01f13c3fd5101e401a265ac0cef1fc8dffcee..5ec5098e7df39d01a743ded774502288fd350ce0 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.326 2004-07-22 05:47:46 geuzaine Exp $ +// $Id: GUI.cpp,v 1.327 2004-07-23 01:28:57 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1884,18 +1884,24 @@ void GUI::create_option_window() mesh_butt[16]->type(FL_TOGGLE_BUTTON); mesh_butt[16]->down_box(TOGGLE_BOX); mesh_butt[16]->selection_color(TOGGLE_COLOR); - mesh_butt[22] = new Fl_Check_Button(2 * WB, 2 * WB + 2 * BH, BW, BH, "Draw intersecting volume layer as surface"); - mesh_butt[22]->type(FL_TOGGLE_BUTTON); - mesh_butt[22]->down_box(TOGGLE_BOX); - mesh_butt[22]->selection_color(TOGGLE_COLOR); - mesh_value[14] = new Fl_Value_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "A"); - mesh_value[15] = new Fl_Value_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "B"); - mesh_value[16] = new Fl_Value_Input(2 * WB, 2 * WB + 5 * BH, IW, BH, "C"); - mesh_value[17] = new Fl_Value_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "D"); + mesh_value[14] = new Fl_Value_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "A"); + mesh_value[15] = new Fl_Value_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "B"); + mesh_value[16] = new Fl_Value_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "C"); + mesh_value[17] = new Fl_Value_Input(2 * WB, 2 * WB + 5 * BH, IW, BH, "D"); for(i = 14; i <= 17; i++) { mesh_value[i]->align(FL_ALIGN_RIGHT); } + + mesh_butt[22] = new Fl_Check_Button(2 * WB, 2 * WB + 6 * BH, BW, BH, "Draw intersecting volume layer as surface"); + mesh_butt[22]->type(FL_TOGGLE_BUTTON); + mesh_butt[22]->down_box(TOGGLE_BOX); + mesh_butt[22]->selection_color(TOGGLE_COLOR); + mesh_butt[23] = new Fl_Check_Button(2 * WB, 2 * WB + 7 * BH, BW, BH, "Cut only volume elements"); + mesh_butt[23]->type(FL_TOGGLE_BUTTON); + mesh_butt[23]->down_box(TOGGLE_BOX); + mesh_butt[23]->selection_color(TOGGLE_COLOR); + o->end(); } { diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index c8800c5d1f392692edf1b38ed826bf2e6454a308..50fa6e898d9566963ca0843f6a3f19a9962135cd 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.105 2004-07-22 19:32:02 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.106 2004-07-23 01:28:57 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -354,7 +354,7 @@ void Draw_Mesh_Point(void *a, void *b) if(!(v->Visible & VIS_MESH)) return; - if(intersectCutPlane(1, &v) < 0) + if(!CTX.mesh.cut_plane_only_volume && intersectCutPlane(1, &v) < 0) return; if(v->Degree == 2) @@ -399,7 +399,7 @@ void Draw_Mesh_Line(void *a, void *b) if(part && !(*part)->Visible) return; - if(intersectCutPlane(2, s->V) < 0) + if(!CTX.mesh.cut_plane_only_volume && intersectCutPlane(2, s->V) < 0) return; Xc = 0.5 * (s->V[0]->Pos.X + s->V[1]->Pos.X); @@ -663,7 +663,7 @@ void Draw_Mesh_Triangle(void *a, void *b) if(part && !(*part)->Visible) return; - if(intersectCutPlane(3, s->V) < 0) + if(!CTX.mesh.cut_plane_only_volume && intersectCutPlane(3, s->V) < 0) return; unsigned int col; @@ -809,7 +809,7 @@ void Draw_Mesh_Quadrangle(void *a, void *b) if(part && !(*part)->Visible) return; - if(intersectCutPlane(4, q->V) < 0) + if(!CTX.mesh.cut_plane_only_volume && intersectCutPlane(4, q->V) < 0) return; unsigned int col;