~ubuntu-branches/ubuntu/vivid/meshlab/vivid

« back to all changes in this revision

Viewing changes to meshlab/src/fgt/filter_func/filter_func.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
}
76
76
 
77
77
// short string describing each filtering action 
78
 
const QString FilterFunctionPlugin::filterName(FilterIDType filterId) 
 
78
const QString FilterFunctionPlugin::filterName(FilterIDType filterId) const
79
79
{
80
80
        switch(filterId) {
81
81
                case FF_VERT_SELECTION :  return QString("Conditional Vertex Selection");
104
104
                                                                                                                                                "<b>q0,q1,q2</b> for <b>quality</b>.<br>");
105
105
 
106
106
// long string describing each filtering action 
107
 
const QString FilterFunctionPlugin::filterInfo(FilterIDType filterId)
 
107
const QString FilterFunctionPlugin::filterInfo(FilterIDType filterId) const
108
108
{
109
109
        switch(filterId) {
110
110
                case FF_VERT_SELECTION : return tr("Boolean function using muparser lib to perform vertex selection over current mesh.<br>"
212
212
// - the string shown in the dialog 
213
213
// - the default value
214
214
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
215
 
void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst) 
 
215
void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst) 
216
216
{
217
217
        Q_UNUSED(m);
218
218
        switch(ID(action))       {
219
219
 
220
220
                case FF_VERT_SELECTION :
221
 
                        parlst.addString("condSelect","(q < 0)", "boolean function",
 
221
                        parlst.addParam(new RichString("condSelect","(q < 0)", "boolean function",
222
222
                                                         "type a boolean function that will be evaluated in order to select a subset of vertices<br>"
223
 
                                                         "example: (y > 0) and (ny > 0)");
 
223
                                                         "example: (y > 0) and (ny > 0)"));
224
224
 
225
 
                        parlst.addBool("strictSelect",true,"Strict face selection", "If checked a face is selected if <b>ALL</b> its vertices are selected. <br>"
226
 
                                                                                 "If unchecked a face is selected if <b>at least one</b> of its vertices is selected");
 
225
                        parlst.addParam(new RichBool("strictSelect",true,"Strict face selection", "If checked a face is selected if <b>ALL</b> its vertices are selected. <br>"
 
226
                                                                                 "If unchecked a face is selected if <b>at least one</b> of its vertices is selected"));
227
227
                        break;
228
228
 
229
229
                case FF_FACE_SELECTION :
230
 
                        parlst.addString("condSelect","(fi == 0)", "boolean function",
231
 
                                                         "type a boolean function that will be evaluated in order to select a subset of faces<br>");
 
230
                        parlst.addParam(new RichString("condSelect","(fi == 0)", "boolean function",
 
231
                                                         "type a boolean function that will be evaluated in order to select a subset of faces<br>"));
232
232
                        break;
233
233
 
234
234
                case FF_GEOM_FUNC :
235
 
                        parlst.addString("x","x", "func x = ", "insert function to generate new coord for x");
236
 
                        parlst.addString("y","y", "func y = ", "insert function to generate new coord for y");
237
 
                        parlst.addString("z","sin(x+y)", "func z = ", "insert function to generate new coord for z");
 
235
                        parlst.addParam(new RichString("x","x", "func x = ", "insert function to generate new coord for x"));
 
236
                        parlst.addParam(new RichString("y","y", "func y = ", "insert function to generate new coord for y"));
 
237
                        parlst.addParam(new RichString("z","sin(x+y)", "func z = ", "insert function to generate new coord for z"));
238
238
                        break;
239
239
 
240
240
                case FF_FACE_COLOR:
241
 
                        parlst.addString("r","255", "func r = ", "function to generate Red component. Expected Range 0-255");
242
 
                        parlst.addString("g","0", "func g = ", "function to generate Green component. Expected Range 0-255");
243
 
                        parlst.addString("b","255", "func b = ", "function to generate Blue component. Expected Range 0-255");
 
241
                        parlst.addParam(new RichString("r","255", "func r = ", "function to generate Red component. Expected Range 0-255"));
 
242
                        parlst.addParam(new RichString("g","0", "func g = ", "function to generate Green component. Expected Range 0-255"));
 
243
                        parlst.addParam(new RichString("b","255", "func b = ", "function to generate Blue component. Expected Range 0-255"));
244
244
                        break;
245
245
 
246
246
                case FF_FACE_QUALITY:
247
 
                        parlst.addString("q","x0+y0+z0", "func q0 = ", "function to generate new Quality foreach face");
248
 
                        parlst.addBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]");
249
 
                        parlst.addBool("map",false,"map into color", "if checked map quality generated values into per-vertex color");
 
247
                        parlst.addParam(new RichString("q","x0+y0+z0", "func q0 = ", "function to generate new Quality foreach face"));
 
248
                        parlst.addParam(new RichBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]"));
 
249
                        parlst.addParam(new RichBool("map",false,"map into color", "if checked map quality generated values into per-vertex color"));
250
250
                        break;
251
251
 
252
252
                case FF_VERT_COLOR:
253
 
                        parlst.addString("x","255", "func r = ", "function to generate Red component. Expected Range 0-255");
254
 
                        parlst.addString("y","255", "func g = ", "function to generate Green component. Expected Range 0-255");
255
 
                        parlst.addString("z","0", "func b = ", "function to generate Blue component. Expected Range 0-255");
 
253
                        parlst.addParam(new RichString("x","255", "func r = ", "function to generate Red component. Expected Range 0-255"));
 
254
                        parlst.addParam(new RichString("y","255", "func g = ", "function to generate Green component. Expected Range 0-255"));
 
255
                        parlst.addParam(new RichString("z","0", "func b = ", "function to generate Blue component. Expected Range 0-255"));
256
256
                        break;
257
257
 
258
258
                case FF_VERT_QUALITY:
259
 
                        parlst.addString("q","vi", "func q = ", "function to generate new Quality for every vertex");
260
 
                        parlst.addBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]");
261
 
                        parlst.addBool("map",false,"map into color", "if checked map quality generated values into per-vertex color");
 
259
                        parlst.addParam(new RichString("q","vi", "func q = ", "function to generate new Quality for every vertex"));
 
260
                        parlst.addParam(new RichBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]"));
 
261
                        parlst.addParam(new RichBool("map",false,"map into color", "if checked map quality generated values into per-vertex color"));
262
262
                        break;
263
263
 
264
264
                case FF_DEF_VERT_ATTRIB:
265
 
                        parlst.addString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name");
266
 
                        parlst.addString("expr","x","Function =", "function to calculate custom attribute value for each vertex");
 
265
                        parlst.addParam(new RichString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name"));
 
266
                        parlst.addParam(new RichString("expr","x","Function =", "function to calculate custom attribute value for each vertex"));
267
267
                        break;
268
268
 
269
269
                case FF_DEF_FACE_ATTRIB:
270
 
                        parlst.addString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name");
271
 
                        parlst.addString("expr","fi","Function =", "function to calculate custom attribute value for each vertex");
 
270
                        parlst.addParam(new RichString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name"));
 
271
                        parlst.addParam(new RichString("expr","fi","Function =", "function to calculate custom attribute value for each vertex"));
272
272
                        break;
273
273
 
274
274
                case FF_GRID :
275
 
                        parlst.addInt("numVertX", 10, "num vertices on x", "number of vertices on x. it must be positive");
276
 
                        parlst.addInt("numVertY", 10, "num vertices on y", "number of vertices on y. it must be positive");
277
 
                        parlst.addFloat("absScaleX", 0.3f, "x scale", "absolute scale on x (float)");
278
 
                        parlst.addFloat("absScaleY", 0.3f, "y scale", "absolute scale on y (float)");
279
 
                        parlst.addBool("center",false,"centered on origin", "center grid generated by filter on origin.<br>"
280
 
                                                   "Grid is first generated and than moved into origin (using muparser lib to perform fast calc on every vertex)");
 
275
                        parlst.addParam(new RichInt("numVertX", 10, "num vertices on x", "number of vertices on x. it must be positive"));
 
276
                        parlst.addParam(new RichInt("numVertY", 10, "num vertices on y", "number of vertices on y. it must be positive"));
 
277
                        parlst.addParam(new RichFloat("absScaleX", 0.3f, "x scale", "absolute scale on x (float)"));
 
278
                        parlst.addParam(new RichFloat("absScaleY", 0.3f, "y scale", "absolute scale on y (float)"));
 
279
                        parlst.addParam(new RichBool("center",false,"centered on origin", "center grid generated by filter on origin.<br>"
 
280
                                                   "Grid is first generated and than moved into origin (using muparser lib to perform fast calc on every vertex)"));
281
281
                        break;
282
282
                case FF_ISOSURFACE :
283
 
                        parlst.addFloat("voxelSize", 0.05, "Size of Voxel", "Size of the voxel that is used by for the grid where the field is sampled. Smaller this value, higher precision, but higher processing times.");
284
 
                        parlst.addFloat("minX", -1, "Min X", "Range where the field is sampled");
285
 
                        parlst.addFloat("minY", -1, "Min Y", "Range where the field is sampled");
286
 
                        parlst.addFloat("minZ", -1, "Min Z", "Range where the field is sampled");
287
 
                        parlst.addFloat("maxX",  1, "Max X", "Range where the field is sampled");
288
 
                        parlst.addFloat("maxY",  1, "Max Y", "Range where the field is sampled");
289
 
                        parlst.addFloat("maxZ",  1, "Max Z", "Range where the field is sampled");
290
 
                        parlst.addString("expr","x*x+y*y+z*z-0.5","Function =", "This expression is evaluated for each voxel of the grid. The surface passing through the zero valued points of this field is then extracted using marching cube.");
 
283
                        parlst.addParam(new RichFloat("voxelSize", 0.05, "Size of Voxel", "Size of the voxel that is used by for the grid where the field is sampled. Smaller this value, higher precision, but higher processing times."));
 
284
                        parlst.addParam(new RichFloat("minX", -1, "Min X", "Range where the field is sampled"));
 
285
                        parlst.addParam(new RichFloat("minY", -1, "Min Y", "Range where the field is sampled"));
 
286
                        parlst.addParam(new RichFloat("minZ", -1, "Min Z", "Range where the field is sampled"));
 
287
                        parlst.addParam(new RichFloat("maxX",  1, "Max X", "Range where the field is sampled"));
 
288
                        parlst.addParam(new RichFloat("maxY",  1, "Max Y", "Range where the field is sampled"));
 
289
                        parlst.addParam(new RichFloat("maxZ",  1, "Max Z", "Range where the field is sampled"));
 
290
                        parlst.addParam(new RichString("expr","x*x+y*y+z*z-0.5","Function =", "This expression is evaluated for each voxel of the grid. The surface passing through the zero valued points of this field is then extracted using marching cube."));
291
291
 
292
292
                        break;
293
293
 
294
294
                case FF_REFINE :
295
 
                        parlst.addString("condSelect","(q0 >= 0 and q1 >= 0)","boolean function","type a boolean function that will be evaluated on every edge");
296
 
                        parlst.addString("x","(x0+x1)/2","x =","function to generate x coord of new vertex in [x0,x1].<br>For example (x0+x1)/2");
297
 
                        parlst.addString("y","(y0+y1)/2","y =","function to generate x coord of new vertex in [y0,y1].<br>For example (y0+y1)/2");
298
 
                        parlst.addString("z","(z0+z1)/2","z =","function to generate x coord of new vertex in [z0,z1].<br>For example (z0+z1)/2");
 
295
                        parlst.addParam(new RichString("condSelect","(q0 >= 0 and q1 >= 0)","boolean function","type a boolean function that will be evaluated on every edge"));
 
296
                        parlst.addParam(new RichString("x","(x0+x1)/2","x =","function to generate x coord of new vertex in [x0,x1].<br>For example (x0+x1)/2"));
 
297
                        parlst.addParam(new RichString("y","(y0+y1)/2","y =","function to generate x coord of new vertex in [y0,y1].<br>For example (y0+y1)/2"));
 
298
                        parlst.addParam(new RichString("z","(z0+z1)/2","z =","function to generate x coord of new vertex in [z0,z1].<br>For example (z0+z1)/2"));
299
299
                        break;
300
300
 
301
301
                default : assert(0); 
303
303
}
304
304
 
305
305
// The Real Core Function doing the actual mesh processing.
306
 
bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
 
306
bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
307
307
{
308
308
        Q_UNUSED(cb);
309
309
        switch(ID(filter)) {