178
178
// - the string shown in the dialog
179
179
// - the default value
180
180
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
181
void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, FilterParameterSet& parlst)
182
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst)
181
void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, RichParameterSet& parlst)
182
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, RichParameterSet &parlst)
184
184
int id = ID(action);
185
185
MeshModel *target = md.mm();
187
187
if (id == FP_SELECT_SMALL_COMPONENTS)
189
parlst.addFloat("NbFaceRatio",
189
parlst.addParam(new RichFloat("NbFaceRatio",
191
191
"Small component ratio",
192
192
"This ratio (between 0 and 1) defines the meaning of <i>small</i> as the threshold ratio between the number of faces"
193
"of the largest component and the other ones. A larger value will select more components.");
194
parlst.addBool( "NonClosedOnly",
193
"of the largest component and the other ones. A larger value will select more components."));
194
parlst.addParam(new RichBool( "NonClosedOnly",
196
196
"Select only non closed components",
200
200
else if (id == FP_RADIUS_FROM_DENSITY)
202
parlst.addInt("NbNeighbors",
202
parlst.addParam(new RichInt("NbNeighbors",
204
204
"Number of neighbors",
205
"Number of neighbors used to estimate the local density. Larger values lead to smoother variations.");
205
"Number of neighbors used to estimate the local density. Larger values lead to smoother variations."));
209
209
if ((id & _PROJECTION_))
211
parlst.addMesh( "ControlMesh", target, "Point set",
212
"The point set (or mesh) which defines the MLS surface.");
213
parlst.addMesh( "ProxyMesh", target, "Proxy Mesh",
214
"The mesh that will be projected/resampled onto the MLS surface.");
211
parlst.addParam(new RichMesh( "ControlMesh", target,&md, "Point set",
212
"The point set (or mesh) which defines the MLS surface."));
213
parlst.addParam(new RichMesh( "ProxyMesh", target, &md, "Proxy Mesh",
214
"The mesh that will be projected/resampled onto the MLS surface."));
216
216
if ((id & _PROJECTION_) || (id & _COLORIZE_))
218
parlst.addBool( "SelectionOnly",
218
parlst.addParam(new RichBool( "SelectionOnly",
219
219
target->cm.sfn>0,
220
220
"Selection only",
221
"If checked, only selected vertices will be projected.");
221
"If checked, only selected vertices will be projected."));
224
224
if ( (id & _APSS_) || (id & _RIMLS_) )
226
parlst.addFloat("FilterScale",
226
parlst.addParam(new RichFloat("FilterScale",
228
228
"MLS - Filter scale",
229
229
"Scale of the spatial low pass filter.\n"
230
"It is relative to the radius (local point spacing) of the vertices.");
231
parlst.addFloat("ProjectionAccuracy",
230
"It is relative to the radius (local point spacing) of the vertices."));
231
parlst.addParam(new RichFloat("ProjectionAccuracy",
233
233
"Projection - Accuracy (adv)",
234
234
"Threshold value used to stop the projections.\n"
235
"This value is scaled by the mean point spacing to get the actual threshold.");
236
parlst.addInt( "MaxProjectionIters",
235
"This value is scaled by the mean point spacing to get the actual threshold."));
236
parlst.addParam(new RichInt( "MaxProjectionIters",
238
238
"Projection - Max iterations (adv)",
239
"Max number of iterations for the projection.");
239
"Max number of iterations for the projection."));
244
parlst.addFloat("SphericalParameter",
244
parlst.addParam(new RichFloat("SphericalParameter",
246
246
"MLS - Spherical parameter",
247
247
"Control the curvature of the fitted spheres: 0 is equivalent to a pure plane fit,"
248
248
"1 to a pure spherical fit, values between 0 and 1 gives intermediate results,"
249
249
"while others real values might give interresting results, but take care with extreme"
251
251
if (!(id & _COLORIZE_))
252
parlst.addBool( "AccurateNormal",
252
parlst.addParam(new RichBool( "AccurateNormal",
254
254
"Accurate normals",
255
255
"If checked, use the accurate MLS gradient instead of the local approximation"
256
"to compute the normals.");
256
"to compute the normals."));
259
259
if (id & _RIMLS_)
261
parlst.addFloat("SigmaN",
261
parlst.addParam(new RichFloat("SigmaN",
263
263
"MLS - Sharpness",
264
264
"Width of the filter used by the normal refitting weight."
265
265
"This weight function is a Gaussian on the distance between two unit vectors:"
266
"the current gradient and the input normal. Therefore, typical value range between 0.5 (sharp) to 2 (smooth).");
267
parlst.addInt( "MaxRefittingIters",
266
"the current gradient and the input normal. Therefore, typical value range between 0.5 (sharp) to 2 (smooth)."));
267
parlst.addParam(new RichInt( "MaxRefittingIters",
269
269
"MLS - Max fitting iterations",
270
"Max number of fitting iterations. (0 or 1 is equivalent to the standard IMLS)");
270
"Max number of fitting iterations. (0 or 1 is equivalent to the standard IMLS)"));
273
273
if (id & _PROJECTION_)
275
parlst.addInt( "MaxSubdivisions",
275
parlst.addParam(new RichInt( "MaxSubdivisions",
277
277
"Refinement - Max subdivisions",
278
"Max number of subdivisions.");
279
parlst.addFloat("ThAngleInDegree",
278
"Max number of subdivisions."));
279
parlst.addParam(new RichFloat("ThAngleInDegree",
281
281
"Refinement - Crease angle (degree)",
282
"Threshold angle between two faces controlling the refinement.");
282
"Threshold angle between two faces controlling the refinement."));
285
285
if (id & _AFRONT_)
523
523
c = apss->approxMeanCurvature(p);
526
grad = mls->gradient(p);
527
hess = mls->hessian(p);
528
implicits::WeingartenMap<float> W(grad,hess);
530
mesh->cm.vert[i].PD1() = W.K1Dir();
531
mesh->cm.vert[i].PD2() = W.K2Dir();
532
mesh->cm.vert[i].K1() = W.K1();
533
mesh->cm.vert[i].K2() = W.K2();
527
grad = mls->gradient(p, &errorMask);
528
if (errorMask == MLS_OK && grad.Norm() > 1e-8)
537
case CT_MEAN: c = W.MeanCurvature(); break;
538
case CT_GAUSS: c = W.GaussCurvature(); break;
539
case CT_K1: c = W.K1(); break;
540
case CT_K2: c = W.K2(); break;
541
default: assert(0 && "invalid curvature type");
530
hess = mls->hessian(p);
531
implicits::WeingartenMap<float> W(grad,hess);
533
mesh->cm.vert[i].PD1() = W.K1Dir();
534
mesh->cm.vert[i].PD2() = W.K2Dir();
535
mesh->cm.vert[i].K1() = W.K1();
536
mesh->cm.vert[i].K2() = W.K2();
540
case CT_MEAN: c = W.MeanCurvature(); break;
541
case CT_GAUSS: c = W.GaussCurvature(); break;
542
case CT_K1: c = W.K1(); break;
543
case CT_K2: c = W.K2(); break;
544
default: assert(0 && "invalid curvature type");
547
assert(!math::IsNAN(c) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)");
544
549
mesh->cm.vert[i].Q() = c;
545
550
minc = std::min(c,minc);