Graphite  Version 3
An experimental 3D geometry processing program
mesh_grob_facet_tools.h
Go to the documentation of this file.
1 
2 /*
3  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
4  * Copyright (C) 2000-2009 INRIA - Project ALICE
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * If you modify this software, you should include a notice giving the
21  * name of the person performing the modification, the date of modification,
22  * and the reason for such modification.
23  *
24  * Contact: Bruno Levy - levy@loria.fr
25  *
26  * Project ALICE
27  * LORIA, INRIA Lorraine,
28  * Campus Scientifique, BP 239
29  * 54506 VANDOEUVRE LES NANCY CEDEX
30  * FRANCE
31  *
32  * Note that the GNU General Public License does not permit incorporating
33  * the Software into proprietary programs.
34  *
35  * As an exception to the GPL, Graphite can be linked
36  * with the following (non-GPL) libraries: Qt, SuperLU, WildMagic and CGAL
37  */
38 
39 #ifndef H_OGF_MESH_GFX_TOOLS_MESH_GROB_FACET_TOOLS_H
40 #define H_OGF_MESH_GFX_TOOLS_MESH_GROB_FACET_TOOLS_H
41 
42 #include <OGF/mesh_gfx/common/common.h>
44 
50 namespace OGF {
51 
52  /****************************************************************/
53 
57  class MESH_GFX_API MeshGrobCreateCenterVertex : public MeshGrobTool {
58  public:
64  ToolsManager* parent
65  ) : MeshGrobTool(parent),
66  new_vertex_(NO_VERTEX) {
67  }
68 
72  void grab(const RayPick& p_ndc) override;
73 
77  void drag(const RayPick& p_ndc) override;
78  private:
79  index_t new_vertex_;
80  };
81 
85  class MESH_GFX_API MeshGrobRemoveCenterVertex : public MeshGrobTool {
86  public:
92  ToolsManager* parent
93  ) : MeshGrobTool(parent) {
94  }
98  void grab(const RayPick& p_ndc) override;
99  };
100 
101 
107  gom_attribute(category, "facets")
108  gom_attribute(icon, "create_center_vertex")
109  gom_attribute(help, "create new vertex in facet / remove center vertex")
110  gom_attribute(message,
111  "btn1: create center vertex; btn3: remove center vertex"
112  )
113  gom_class MESH_GFX_API MeshGrobEditCenterVertex : public MultiTool {
114  public:
120  set_tool(
121  MOUSE_BUTTON_LEFT, new MeshGrobCreateCenterVertex(parent)
122  );
123  set_tool(
124  MOUSE_BUTTON_RIGHT, new MeshGrobRemoveCenterVertex(parent)
125  );
126  }
130  void reset() override;
131  };
132 
133 
134  /****************************************************************/
135 
139  gom_attribute(category, "facets")
140  gom_attribute(icon, "remove_incident_facets")
141  gom_attribute(help, "remove facets incident to a vertex")
142  gom_attribute(message, "btn1: remove facets incident to vertex")
143  gom_class MESH_GFX_API MeshGrobRemoveIncidentFacets : public MeshGrobTool {
144  public:
150  ToolsManager* parent
151  ) : MeshGrobTool(parent) {
152  }
153 
157  void reset() override;
158 
162  void grab(const RayPick& p_ndc) override;
163  };
164 
165  /****************************************************************/
166 
170  class MESH_GFX_API MeshGrobRemoveFacet : public MeshGrobTool {
171  public:
177  }
178 
182  void grab(const RayPick& p_ndc) override;
183  };
184 
188  class MESH_GFX_API MeshGrobFillHole : public MeshGrobTool {
189  public:
195  }
196 
200  void grab(const RayPick& p_ndc) override;
201  };
202 
208  gom_attribute(category, "facets")
209  gom_attribute(icon, "fill_hole")
210  gom_attribute(help, "fill hole / remove facet")
211  gom_attribute(message, "btn1: fill hole; btn3: remove facet")
212  gom_class MESH_GFX_API MeshGrobEditHole : public MultiTool {
213  public:
214 
220  set_tool(MOUSE_BUTTON_LEFT, new MeshGrobFillHole(parent));
221  set_tool(MOUSE_BUTTON_RIGHT, new MeshGrobRemoveFacet(parent));
222  }
223 
227  ~MeshGrobEditHole() override;
228  };
229 
230  /****************************************************************/
231 
236  gom_attribute(category, "facets")
237  gom_attribute(icon, "move_facet")
238  gom_attribute(help, "move facet / resize facet / rotate facet")
239  gom_attribute(message,
240  "btn1: move facet; btn2: resize facet; btn3: rotate facet"
241  )
243  public:
249  ToolsManager* parent
250  ) : MeshGrobTransformTool(parent) {
251  }
252 
253  protected:
258  MeshGrobTransformSubset* tool, const RayPick& rp
259  ) override;
260 
264  void transform_subset(const mat4& M) override;
265 
266  index_t picked_facet_;
267  };
268 
269  /****************************************************************/
270 
275  public:
276 
282  ToolsManager* parent
283  ) : MeshGrobTool(parent) {
284  }
285 
289  void grab(const RayPick& p_ndc) override;
290  };
291 
292 
298  public:
299 
305  ToolsManager* parent
306  ) :
307  MeshGrobTool(parent),
308  v1_(NO_VERTEX),
309  v2_(NO_VERTEX) {
310  }
311 
315  void grab(const RayPick& p_ndc) override;
316 
320  void reset() override;
321  private:
322  index_t v1_;
323  index_t v2_;
324  };
325 
331  gom_attribute(category, "facets")
332  gom_attribute(icon, "split_facet")
333  gom_attribute(help, "split facet / merge facets")
334  gom_attribute(message,
335  "btn1: split facet (select vertices); btn3: merge facets (select edge)"
336  )
337  gom_class MESH_GFX_API MeshGrobEditFacetEdge : public MultiTool {
338  public:
344  set_tool(MOUSE_BUTTON_LEFT, new MeshGrobSplitFacet(parent));
345  set_tool(MOUSE_BUTTON_RIGHT, new MeshGrobJoinFacets(parent));
346  }
347 
351  void reset() override;
352  };
353 }
354 
355 #endif
A tool that creates a vertex in the center of a facet.
void drag(const RayPick &p_ndc) override
The event handler for mouse drag events.
void grab(const RayPick &p_ndc) override
MeshGrobCreateCenterVertex(ToolsManager *parent)
MeshGrobCreateCenterVertex constructor.
A tool that creates/removes a vertex in a facet depending on the pushed mouse button.
MeshGrobEditCenterVertex(ToolsManager *parent)
MeshGrobEditCenterVertex constructor.
void reset() override
Resets this Tool.
A tool that splits/merges facets depending on the pushed mouse button.
void reset() override
Resets this Tool.
MeshGrobEditFacetEdge(ToolsManager *parent)
MeshGrobEditFacetEdge constructor.
A tool that create or removes a facet, depending on the pushed mouse button.
MeshGrobEditHole(ToolsManager *parent)
MeshGrobEditHole constructor.
~MeshGrobEditHole() override
MeshGrobEditHole destructor.
A tool that fills a hole by creating a new facet.
MeshGrobFillHole(ToolsManager *parent)
MeshGrobFillHole constructor.
void grab(const RayPick &p_ndc) override
A tool that joins two adjacent facet to form a single one.
void grab(const RayPick &p_ndc) override
MeshGrobJoinFacets(ToolsManager *parent)
MeshGrobJoinFacets constructor.
A tool that removes a vertex and merges all incident facets.
MeshGrobRemoveCenterVertex(ToolsManager *parent)
MeshGrobRemoveCenterVertex constructor.
void grab(const RayPick &p_ndc) override
A tool that removes a facet.
void grab(const RayPick &p_ndc) override
MeshGrobRemoveFacet(ToolsManager *parent)
MeshGrobRemoveFacet constructor.
A tool that removes all facets incident to a vertex.
void grab(const RayPick &p_ndc) override
void reset() override
Resets this Tool.
MeshGrobRemoveIncidentFacets(ToolsManager *parent)
MeshGrobRemoveIncidentFacets constructor.
A tool that splits a facet by creating a new edge between two picked vertices.
void reset() override
Resets this Tool.
void grab(const RayPick &p_ndc) override
MeshGrobSplitFacet(ToolsManager *parent)
MeshGrobsSplitFacet constructor.
Base class for tools that operate on MeshGrob.
A tool that translates/scales/rotates a facet depending on the pushed mouse button.
void pick_subset(MeshGrobTransformSubset *tool, const RayPick &rp) override
Gets the subset by picking.
MeshGrobTransformFacet(ToolsManager *parent)
MeshGrobTransformFacet constructor.
void transform_subset(const mat4 &M) override
Applies a 3D transform to the subset.
Base class of tools that apply 3d transform to a subset of a MeshGrob and that are attached to a Mult...
A MultiTool that applies a mouse-controlled transform to a subset.
A Tool that can associate a different tool to each button of the mouse.
Definition: tool.h:199
Manages the Tool objects associated with a given Grob class.
Definition: tools_manager.h:62
Base classes for tools that operate on MeshGrob.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
Represents the information related with a picking event.
Definition: ray_picker.h:64