Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
operations-triangulation.cc
Go to the documentation of this file.
1 /*
2  * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler-gmap
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #ifdef MODULE_TRIANGULATION
26 
27 #include "g-map-vertex.hh"
28 #include "controler-gmap.hh"
29 #include "operations.hh"
30 #include "parameter-selection.hh"
31 #include "view-precompile.hh"
32 
33 #include "triangulation-api.hh"
34 #include "triangulation-tools.hh"
35 
36 using namespace GMap3d;
37 
38 //******************************************************************************
39 
41 {
44  CTriangulationAPI api(FMap);
45 
47  api.triangulateMarkedFaces(getSelectionMark(), true);
49 
51  setMessage("Faces triangulated");
52  return true;
53  }
54 
55  return false;
56 }
57 
58 //******************************************************************************
59 
61 {
64  -1))) {
65  CTriangulationAPI api(FMap);
66  CDart *d;
67 
68  if (FMap->getMarkedCells(ORBIT_CC, getSelectionMark(), NULL, &d) != 1) {
69  setMessage("Selected mesh not correct");
70  return false;
71  }
72 
73  FMap->unmarkOrbit(d, ORBIT_CC, getSelectionMark());
74  api.markNonUniformFaces(d, getSelectionMark(), 50);
75 
76  setMessage("Non uniform faces marked");
78  return true;
79  }
80 
81  return false;
82 }
83 
84 //******************************************************************************
85 
87 {
90  CTriangulationAPI api(FMap);
91 
93  api.optimizeMarkedEdges(getSelectionMark());
95 
97  setMessage("Edges positions optimized");
98  return true;
99  }
100 
101  return false;
102 }
103 
104 //******************************************************************************
105 
107 {
110  CTriangulationTools tools(FMap);
111 
112  undoRedoPreSave();
113  tools.createDelaunaySurface(getSelectionMark());
115 
116  setModelChanged();
117  setMessage("Delaunay triangulation done");
118  return true;
119  }
120 
121  return false;
122 }
123 
124 //******************************************************************************
125 
127 {
130  CTriangulationTools tools(FMap);
131 
132  undoRedoPreSave();
133  tools.createDelaunaySurface(getSelectionMark(), 2);
135 
136  setModelChanged();
137  setMessage("Delaunay triangulation done");
138  return true;
139  }
140 
141  return false;
142 }
143 
144 //******************************************************************************
145 
146 #endif // MODULE_TRIANGULATION