本文整理汇总了C++中MeshDocument::mm方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshDocument::mm方法的具体用法?C++ MeshDocument::mm怎么用?C++ MeshDocument::mm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshDocument
的用法示例。
在下文中一共展示了MeshDocument::mm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initParameterSet
//
// Filter interface start up
//
void FilterTopoPlugin::initParameterSet(QAction *action, MeshDocument & md, RichParameterSet & parlst)
{
MeshModel *target= md.mm();
foreach (target, md.meshList)
if (target != md.mm()) break;
doc = &md;
switch(ID(action)) {
case FP_RE_TOPO :
// Iterations editbox
parlst.addParam(new RichInt( "it",
4,
"Number of refinement iterations used to build the new mesh",
"As higher is this value, as well defined will be the new mesh. Consider that more than 5 iterations may slow down your system"));
// Distance editbox
parlst.addParam(new RichAbsPerc( "dist", 0.3f, 0.01f, 0.99f,
"Incremental distance %",
"This param represents the % distance for the local search algorithm used for new vertices allocation. Generally, 0.25-0.30 is a good value"));
// Topology mesh list
parlst.addParam(new RichMesh( "userMesh", md.mm(),
"Topology mesh",
"This mesh will be used as the new base topology, and will be replaced by the new mesh"));
// Original mesh list
parlst.addParam(new RichMesh( "inMesh", target,
"Original mesh",
"The new mesh will be elaborated using this model"));
break;
default : assert(0);
}
}
示例2: MeshDocumentFromNvm
bool MeshDocumentFromNvm(MeshDocument &md, QString filename_nvm, QString model_filename)
{
md.addNewMesh(model_filename,QString("model"));
std::vector<vcg::Shotf> shots;
const QString path = QFileInfo(filename_nvm).absolutePath();
//const QString path_im = QFileInfo(image_list_filename).absolutePath()+QString("/");
std::vector<std::string> image_filenames;
vcg::tri::io::ImporterNVM<CMeshO>::Open(md.mm()->cm,shots,image_filenames,qPrintable(filename_nvm));
md.mm()->updateDataMask(MeshModel::MM_VERTCOLOR);
QString curr_path = QDir::currentPath();
//QFileInfo imi(image_list_filename);
//QDir::setCurrent(imi.absoluteDir().absolutePath());
QStringList image_filenames_q;
for(unsigned int i = 0; i < image_filenames.size(); ++i)
image_filenames_q.push_back(QString::fromStdString(image_filenames[i]));
for(size_t i=0 ; i<shots.size() ; i++){
md.addNewRaster();
const QString fullpath_image_filename = image_filenames_q[i];
md.rm()->addPlane(new Plane(fullpath_image_filename,Plane::RGBA));
md.rm()->setLabel(image_filenames_q[i].section('/',1,2));
md.rm()->shot = shots[i];
/*md.rm()->shot.Intrinsics.ViewportPx[0]=md.rm()->currentPlane->image.width();
md.rm()->shot.Intrinsics.ViewportPx[1]=md.rm()->currentPlane->image.height();
md.rm()->shot.Intrinsics.CenterPx[0]=(int)((double)md.rm()->shot.Intrinsics.ViewportPx[0]/2.0f);
md.rm()->shot.Intrinsics.CenterPx[1]=(int)((double)md.rm()->shot.Intrinsics.ViewportPx[1]/2.0f);*/
}
QDir::setCurrent(curr_path);
return true;
}
示例3: buildParameterSet
void AlignTools::buildParameterSet(MeshDocument &md,RichParameterSet & parlst)
{
vcg::AlignPair::Param ICPParameters;
AlignParameter::buildRichParameterSet(ICPParameters, parlst);
parlst.addParam(new RichBool(UseMarkers, true, "Use Markers for Alignment","if true (default), then use the user picked markers to do an alignment (or pre alignment if you also use ICP)."));
parlst.addParam(new RichBool(AllowScaling, false, "Scale the mesh","if true (false by default), in addition to the alignment, scale the mesh based on the points picked"));
parlst.addParam(new RichBool(UseICP, true, "Use ICP for Alignment","if true (default), then use the ICP to align the two meshes."));
parlst.addParam(new RichMesh (StuckMesh, md.mm(), &md,"Stuck Mesh",
"The mesh that will not move."));
parlst.addParam(new RichMesh (MeshToMove, md.mm(), &md, "Mesh to Move",
"The mesh that will move to fit close to the Stuck Mesh."));
}
示例4: applyFilter
bool FilterCreateIso::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos * cb)
{
md.addNewMesh("",this->filterName(ID(filter)));
MeshModel &m=*(md.mm());
if(filter->text() == filterName(FP_CREATEISO) )
{
SimpleVolume<SimpleVoxel<Scalarm> > volume;
typedef vcg::tri::TrivialWalker<CMeshO, SimpleVolume<SimpleVoxel<Scalarm> > > MyWalker;
typedef vcg::tri::MarchingCubes<CMeshO, MyWalker> MyMarchingCubes;
MyWalker walker;
const int gridSize=par.getInt("Resolution");
// Simple initialization of the volume with some cool perlin noise
volume.Init(Point3i(gridSize,gridSize,gridSize), Box3m(Point3m(0,0,0),Point3m(1,1,1)));
for(int i=0;i<gridSize;i++)
for(int j=0;j<gridSize;j++)
for(int k=0;k<gridSize;k++)
volume.Val(i,j,k)=(j-gridSize/2)*(j-gridSize/2)+(k-gridSize/2)*(k-gridSize/2) + i*gridSize/5*(float)math::Perlin::Noise(i*.2,j*.2,k*.2);
printf("[MARCHING CUBES] Building mesh...");
MyMarchingCubes mc(m.cm, walker);
walker.BuildMesh<MyMarchingCubes>(m.cm, volume, mc, (gridSize*gridSize)/10,cb);
m.UpdateBoxAndNormals();
}
return true;
}
示例5: applyFilter
bool FilterSSynth::applyFilter(QAction* filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
{
QWidget * parent=(QWidget*)this->parent();
RichParameter* grammar=par.findParameter(QString("grammar"));
RichParameter* seed=par.findParameter(QString("seed"));
int sphereres=par.findParameter("sphereres")->val->getInt();
this->renderTemplate=GetTemplate(sphereres);
if(this->renderTemplate!=QString::Null()){
QString path=ssynth(grammar->val->getString(),-50,seed->val->getInt(),cb);
if(QFile::exists(path)){
QFile file(path);
int mask;
QString name(file.fileName());
openX3D(name,*(md.mm()),mask,cb);
file.remove();
return true;
}
else{
QString message=QString("An error occurred during the mesh generation:" ).append(path);
QMessageBox::critical(parent,"Error",message);
return false;
}
}
else{
QMessageBox::critical(parent,"Error","Sphere resolution must be between 1 and 4"); return false;
}
}
示例6: initParameterSetForFractalDisplacement
void FilterFractal::initParameterSetForFractalDisplacement(QAction *filter, MeshDocument &md, RichParameterSet &par)
{
bool terrain_filter = (ID(filter) == CR_FRACTAL_TERRAIN);
if(terrain_filter) {
par.addParam(new RichInt("steps", 8, "Subdivision steps:", "Defines the detail of the generated terrain. Allowed values are in range [2,9]. Use values from 6 to 9 to obtain reasonable results."));
par.addParam(new RichDynamicFloat("maxHeight", 0.2, 0, 1, "Max height:", "Defines the maximum perturbation height as a fraction of the terrain's side."));
} else {
float diag = md.mm()->cm.bbox.Diag();
par.addParam(new RichAbsPerc("maxHeight", 0.02 * diag, 0, 0.5*diag, "Max height:", "Defines the maximum height for the perturbation."));
}
par.addParam(new RichDynamicFloat("scale", 1, 0, 10, "Scale factor:", "Scales the fractal perturbation in and out. Values larger than 1 mean zoom out; values smaller than one mean zoom in."));
if (!terrain_filter)
{
par.addParam(new RichInt("smoothingSteps", 5, "Normals smoothing steps:", "Face normals will be smoothed to make the perturbation more homogeneous. This parameter represents the number of smoothing steps." ));
}
par.addParam(new RichFloat("seed", 2, "Seed:", "By varying this seed, the terrain morphology will change.\nDon't change the seed if you want to refine the current terrain morphology by changing the other parameters."));
QStringList algList;
algList << "fBM (fractal Brownian Motion)" << "Standard multifractal" << "Heterogeneous multifractal" << "Hybrid multifractal terrain" << "Ridged multifractal terrain";
par.addParam(new RichEnum("algorithm", 4, algList, "Algorithm", "The algorithm with which the fractal terrain will be generated."));
par.addParam(new RichDynamicFloat("octaves", 8.0, 1.0, 20.0, "Octaves:", "The number of Perlin noise frequencies that will be used to generate the terrain. Reasonable values are in range [2,9]."));
par.addParam(new RichFloat("lacunarity", 4.0, "Lacunarity:", "The gap between noise frequencies. This parameter is used in conjunction with fractal increment to compute the spectral weights that contribute to the noise in each octave."));
par.addParam(new RichFloat("fractalIncrement", terrain_filter? 0.5 : 0.2, "Fractal increment:", "This parameter defines how rough the generated terrain will be. The range of reasonable values changes according to the used algorithm, however you can choose it in range [0.2, 1.5]."));
par.addParam(new RichFloat("offset", 0.9, "Offset:", "This parameter controls the multifractality of the generated terrain. If offset is low, then the terrain will be smooth."));
par.addParam(new RichFloat("gain", 2.5, "Gain:", "Ignored in all the algorithms except the ridged one. This parameter defines how hard the terrain will be."));
par.addParam(new RichBool("saveAsQuality", false, "Save as vertex quality", "Saves the perturbation value as vertex quality."));
}
示例7: applyFilter
// The Real Core Function doing the actual mesh processing.
// Move Vertex of a random quantity
bool ExtraSamplePlugin::applyFilter(QAction */*filter*/, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
{
CMeshO &m = md.mm()->cm;
srand(time(NULL));
const float max_displacement =par.getAbsPerc("Displacement");
for(unsigned int i = 0; i< m.vert.size(); i++){
// Typical usage of the callback for showing a nice progress bar in the bottom.
// First parameter is a 0..100 number indicating percentage of completion, the second is an info string.
cb(100*i/m.vert.size(), "Randomly Displacing...");
float rndax = (float(2.0f*rand())/RAND_MAX - 1.0f ) *max_displacement;
float rnday = (float(2.0f*rand())/RAND_MAX - 1.0f ) *max_displacement;
float rndaz = (float(2.0f*rand())/RAND_MAX - 1.0f ) *max_displacement;
m.vert[i].P() += vcg::Point3f(rndax,rnday,rndaz);
}
// Log function dump textual info in the lower part of the MeshLab screen.
Log("Successfully displaced %i vertices",m.vn);
// to access to the parameters of the filter dialog simply use the getXXXX function of the FilterParameter Class
if(par.getBool("UpdateNormals"))
vcg::tri::UpdateNormal<CMeshO>::PerVertexNormalizedPerFace(m);
vcg::tri::UpdateBounding<CMeshO>::Box(m);
return true;
}
示例8: initParameterSetForCratersGeneration
void FilterFractal::initParameterSetForCratersGeneration(MeshDocument &md, RichParameterSet &par)
{
int meshCount = md.meshList.size();
// tries to detect the target mesh
MeshModel* target = md.mm();
MeshModel* samples = md.mm();
MeshModel* tmpMesh;
if (samples->cm.fn != 0){ // this is probably not the samples layer
for(int i=0; i<meshCount; i++)
{
tmpMesh = md.meshList.at(i);
if (tmpMesh->cm.fn == 0)
{
samples = tmpMesh;
break;
}
}
}
par.addParam(new RichMesh("target_mesh", target, &md, "Target mesh:", "The mesh on which craters will be generated."));
par.addParam(new RichMesh("samples_mesh", samples, &md, "Samples layer:", "The samples that represent the central points of craters."));
par.addParam(new RichInt("seed", 0, "Seed:", "The seed with which the random number generator is initialized. The random generator generates radius and depth for each crater into the given range."));
par.addParam(new RichInt("smoothingSteps", 5, "Normals smoothing steps:", "Vertex normals are smoothed this number of times before generating craters."));
QStringList algList;
algList << "f1 (Gaussian)" << "f2 (Multiquadric)" << "f3";
par.addParam(new RichEnum("rbf", 1, algList, "Radial function:", "The radial function used to generate craters."));
par.addParam(new RichDynamicFloat("min_radius", 0.1, 0, 1, "Min crater radius:", "Defines the minimum radius of craters in range [0, 1]. Values near 0 mean very small craters."));
par.addParam(new RichDynamicFloat("max_radius", 0.35, 0, 1, "Max crater radius:", "Defines the maximum radius of craters in range [0, 1]. Values near 1 mean very large craters."));
par.addParam(new RichDynamicFloat("min_depth", 0.05, 0, 1, "Min crater depth:", "Defines the minimum depth of craters in range [0, 1]."));
par.addParam(new RichDynamicFloat("max_depth", 0.15, 0, 1, "Max crater depth:", "Defines the maximum depth of craters in range [0, 1]. Values near 1 mean very deep craters."));
par.addParam(new RichDynamicFloat("elevation", 0.4, 0, 1, "Elevation:", "Defines how much the crater rise itself from the mesh surface, giving an \"impact-effect\"."));
QStringList blendList;
blendList << "Exponential blending" << "Linear blending" << "Gaussian blending" << "f3 blending";
par.addParam(new RichEnum("blend", 3, blendList, "Blending algorithm:", "The algorithm that is used to blend the perturbation towards the mesh surface."));
par.addParam(new RichDynamicFloat("blendThreshold", 0.8, 0, 1, "Blending threshold:", "The fraction of craters radius beyond which the radial function is replaced with the blending function."));
par.addParam(new RichBool("successiveImpacts", true, "Successive impacts", "If not checked, the impact-effects of generated craters will be superimposed with each other."));
par.addParam(new RichBool("ppNoise", true, "Postprocessing noise", "Slightly perturbates the craters with a noise function."));
par.addParam(new RichBool("invert", false, "Invert perturbation", "If checked, inverts the sign of radial perturbation to create bumps instead of craters."));
par.addParam(new RichBool("save_as_quality", false, "Save as vertex quality", "Saves the perturbation as vertex quality."));
return;
}
示例9: MeshDocumentFromBundler
bool MeshDocumentFromBundler(MeshDocument &md, QString filename_out,QString image_list_filename, QString model_filename)
{
md.addNewMesh(model_filename,QString("model"));
std::vector<Shotm> shots;
const QString path = QFileInfo(filename_out).absolutePath();
const QString path_im = QFileInfo(image_list_filename).absolutePath()+QString("/");
std::vector<std::string> image_filenames;
vcg::tri::io::ImporterOUT<CMeshO>::Open(md.mm()->cm,shots,image_filenames, qUtf8Printable(filename_out), qUtf8Printable(image_list_filename));
md.mm()->updateDataMask(MeshModel::MM_VERTCOLOR);
QString curr_path = QDir::currentPath();
QFileInfo imi(image_list_filename);
//
QStringList image_filenames_q;
for(unsigned int i = 0; i < image_filenames.size(); ++i)
{
QImageReader sizeImg(QString::fromStdString(image_filenames[i]));
if(sizeImg.size()==QSize(-1,-1))
image_filenames_q.push_back(path_im+QString::fromStdString(image_filenames[i]));
else
image_filenames_q.push_back(QString::fromStdString(image_filenames[i]));
}
QDir::setCurrent(imi.absoluteDir().absolutePath());
for(size_t i=0 ; i<shots.size() ; i++)
{
md.addNewRaster();
const QString fullpath_image_filename = image_filenames_q[int(i)];
md.rm()->addPlane(new Plane(fullpath_image_filename,Plane::RGBA));
int count=fullpath_image_filename.count('\\');
if (count==0)
{
count=fullpath_image_filename.count('/');
md.rm()->setLabel(fullpath_image_filename.section('/',count,1));
}
else
md.rm()->setLabel(fullpath_image_filename.section('\\',count,1));
md.rm()->shot = shots[i];
}
QDir::setCurrent(curr_path);
return true;
}
示例10: applyFilter
// Core
bool FilterWebExportVMustPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb)
{
if (ID(filter) == FP_WEB_EXPORT)
{
CMeshO &m=md.mm()->cm;
QNetworkAccessManager NAManager;
// STEP 1: check if the server works (by requesting the list of application templates)
// (note that this list is not used)
QUrl urlTest ("http://pipeline.v-must.net/api/v1/bundles");
QNetworkRequest request1(urlTest);
QNetworkReply *reply1 = NAManager.get(request1);
QTimer timer;
timer.setSingleShot(true);
timer.start(5000);
QEventLoop eventLoop;
connect(reply1, SIGNAL(finished()), &eventLoop, SLOT(quit()));
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
eventLoop.exec(); // block the http request for 5 seconds
delete reply1;
if (timer.isActive())
{
timer.stop();
// STEP 2: preparing the bucket for the processing
QUrl urlBucket("http://pipeline.v-must.net/api/v1/buckets");
QNetworkRequest request2(urlBucket);
request2.setRawHeader("Accept", "application/json");
request2.setRawHeader("Accept-Encoding", "gzip, deflate, compress");
request2.setRawHeader("Content-Type", "application/octet-stream");
request2.setRawHeader("Host", "pipelineserver.ltd");
request2.setRawHeader("X-Filename", "test.ply");
QNetworkReply *reply2 = NAManager.get(request2);
connect(reply2, SIGNAL(finished()), &eventLoop, SLOT(quit()));
eventLoop.exec(); // block the http request
// STEP 3: launch the processing according to the selected template
}
else
{
QMessageBox::warning(0, tr("V-Must CIF API"), tr("Server is time out. Please, re-try later."));
}
}
return true;
}
示例11: decorateDoc
void DecorateBackgroundPlugin::decorateDoc(QAction *a, MeshDocument &m, RichParameterSet * parset,GLArea *gla, QPainter *, GLLogStream &)
{
static QString lastname("unitialized");
switch(ID(a))
{
case DP_SHOW_CUBEMAPPED_ENV :
{
if(!cm.IsValid() || (lastname != cubemapFileName ) )
{
qDebug( "Current CubeMapPath Dir: %s ",qPrintable(cubemapFileName));
glewInit();
bool ret = cm.Load(qPrintable(cubemapFileName));
lastname=cubemapFileName;
if(! ret ) return;
//QMessageBox::warning(gla,"Cubemapped background decoration","Warning unable to load cube map images: " + cubemapFileName );
cm.radius=10;
}
if(!cm.IsValid()) return;
Matrix44f tr;
glGetv(GL_MODELVIEW_MATRIX,tr);
// Remove the translation from the current matrix by simply padding the last column of the matrix
tr.SetColumn(3,Point4f(0,0,0,1.0));
//Remove the scaling from the the current matrix by adding an inverse scaling matrix
float scale = 1.0/pow(tr.Determinant(),1.0f/3.0f);
Matrix44f Scale;
Scale.SetDiagonal(scale);
tr=tr*Scale;
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
cm.DrawEnvCube(tr);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
} break;
case DP_SHOW_GRID :
{
emit this->askViewerShot("me");
Box3f bb=m.bbox();
float scaleBB = parset->getFloat(BoxRatioParam());
float majorTick = parset->getFloat(GridMajorParam());
float minorTick = parset->getFloat(GridMinorParam());
bool gridSnap = parset->getBool(GridSnapParam());
bool backFlag = parset->getBool(GridBackParam());
bool shadowFlag = parset->getBool(ShowShadowParam());
Color4b backColor = parset->getColor4b(GridColorBackParam());
Color4b frontColor = parset->getColor4b(GridColorFrontParam());
bb.Offset((bb.max-bb.min)*(scaleBB-1.0));
DrawGriddedCube(*m.mm(),bb,majorTick,minorTick,gridSnap,backFlag,shadowFlag,backColor,frontColor,gla);
} break;
}
}
示例12: applyFilter
// Core Function doing the actual mesh processing.
bool RangeMapPlugin::applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & par, vcg::CallBackPos *cb)
{
CMeshO::FaceIterator fi;
switch(ID(filter))
{
case FP_SELECTBYANGLE :
{
bool usecam = par.getBool("usecamera");
Point3f viewpoint = par.getPoint3f("viewpoint");
// if usecamera but mesh does not have one
if( usecam && !m.mm()->hasDataMask(MeshModel::MM_CAMERA) )
{
errorMessage = "Mesh has not a camera that can be used to compute view direction. Please set a view direction."; // text
return false;
}
if(usecam)
{
viewpoint = m.mm()->cm.shot.GetViewPoint();
}
// angle threshold in radians
float limit = cos( math::ToRad(par.getDynamicFloat("anglelimit")) );
Point3f viewray;
for(fi=m.mm()->cm.face.begin();fi!=m.mm()->cm.face.end();++fi)
if(!(*fi).IsD())
{
viewray = viewpoint - Barycenter(*fi);
viewray.Normalize();
if((viewray.dot((*fi).N().Normalize())) < limit)
fi->SetS();
}
}
break;
}
return true;
}
示例13: initParameterSet
void FilterCSG::initParameterSet(QAction *action, MeshDocument & md, RichParameterSet & parlst)
{
switch (ID(action)) {
case FP_CSG:
{
MeshModel *target = md.mm();
foreach (target, md.meshList)
if (target != md.mm())
break;
CMeshO::ScalarType mindim = min(md.mm()->cm.bbox.Dim().V(md.mm()->cm.bbox.MinDim()),
target->cm.bbox.Dim().V(target->cm.bbox.MinDim()));
parlst.addParam(new RichMesh("FirstMesh", md.mm(), &md, "First Mesh",
"The first operand of the CSG operation"));
parlst.addParam(new RichMesh("SecondMesh", target, &md, "Second Mesh",
"The second operand of the CSG operation"));
parlst.addParam(new RichAbsPerc("Delta", mindim / 100.0, 0, mindim,
"Spacing between sampling lines",
"This parameter controls the accuracy of the result and the speed of the computation."
"The time and memory needed to perform the operation usually scale as the reciprocal square of this value."
"For optimal results, this value should be at most half the the smallest feature (i.e. the highest frequency) you want to reproduce."));
parlst.addParam(new RichInt("SubDelta", 32, "Discretization points per sample interval",
"This is the number of points between the sampling lines to which the vertices can be rounded."
"Increasing this can marginally increase the precision and decrease the speed of the operation."));
parlst.addParam(new RichEnum("Operator", 0,
QStringList() << "Intersection" << "Union" << "Difference", "Operator",
"Intersection takes the volume shared between the two meshes; "
"Union takes the volume included in at least one of the two meshes; "
"Difference takes the volume included in the first mesh but not in the second one"));
parlst.addParam(new RichBool("Extended", false, "Extended Marching Cubes",
"Use extended marching cubes for surface reconstruction. "
"It tries to improve the quality of the mesh by reconstructing the sharp features "
"using the information in vertex normals"));
}
break;
default:
assert(0);
}
}
示例14: initParameterSet
void CleanFilter::initParameterSet(QAction *action,MeshDocument &md, RichParameterSet & parlst)
{
pair<float,float> qualityRange;
switch(ID(action))
{
case FP_BALL_PIVOTING :
parlst.addParam(new RichAbsPerc("BallRadius",(float)maxDiag1,0,md.mm()->cm.bbox.Diag(),"Pivoting Ball radius (0 autoguess)","The radius of the ball pivoting (rolling) over the set of points. Gaps that are larger than the ball radius will not be filled; similarly the small pits that are smaller than the ball radius will be filled."));
parlst.addParam(new RichFloat("Clustering",20.0f,"Clustering radius (% of ball radius)","To avoid the creation of too small triangles, if a vertex is found too close to a previous one, it is clustered/merged with it."));
parlst.addParam(new RichFloat("CreaseThr", 90.0f,"Angle Threshold (degrees)","If we encounter a crease angle that is too large we should stop the ball rolling"));
parlst.addParam(new RichBool("DeleteFaces",false,"Delete intial set of faces","if true all the initial faces of the mesh are deleted and the whole surface is rebuilt from scratch, other wise the current faces are used as a starting point. Useful if you run multiple times the algorithm with an incrasing ball radius."));
break;
case FP_REMOVE_ISOLATED_DIAMETER:
parlst.addParam(new RichAbsPerc("MinComponentDiag",md.mm()->cm.bbox.Diag()/10.0,0,md.mm()->cm.bbox.Diag(),"Enter max diameter of isolated pieces","Delete all the connected components (floating pieces) with a diameter smaller than the specified one"));
break;
case FP_REMOVE_ISOLATED_COMPLEXITY:
parlst.addParam(new RichInt("MinComponentSize",(int)minCC,"Enter minimum conn. comp size:","Delete all the connected components (floating pieces) composed by a number of triangles smaller than the specified one"));
break;
case FP_REMOVE_WRT_Q:
qualityRange=tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(md.mm()->cm);
parlst.addParam(new RichAbsPerc("MaxQualityThr",(float)val1, qualityRange.first, qualityRange.second,"Delete all vertices with quality under:"));
break;
case FP_MERGE_CLOSE_VERTEX :
parlst.addParam(new RichAbsPerc("Threshold",md.mm()->cm.bbox.Diag()/10000.0,0,md.mm()->cm.bbox.Diag()/100.0,"Merging distance","All the vertices that closer than this threshold are merged together. Use very small values, default values is 1/10000 of bounding box diagonal. "));
break;
case FP_SNAP_MISMATCHED_BORDER:
parlst.addParam(new RichFloat("EdgeDistRatio",1/100.0f,"Edge Distance Ratio", "Collapse edge when the edge / distance ratio is greater than this value. E.g. for default value 1000 two straight border edges are collapsed if the central vertex dist from the straight line composed by the two edges less than a 1/1000 of the sum of the edges lenght. Larger values enforce that only vertexes very close to the line are removed."));
parlst.addParam(new RichBool("UnifyVertices",true,"UnifyVertices","if true the snap vertices are weld together."));
break;
case FP_REMOVE_TVERTEX_COLLAPSE :
case FP_REMOVE_TVERTEX_FLIP :
parlst.addParam(new RichFloat(
"Threshold", 40, "Ratio", "Detects faces where the base/height ratio is lower than this value"));
parlst.addParam(new RichBool(
"Repeat", true, "Iterate until convergence", "Iterates the algorithm until it reaches convergence"));
break;
case FP_REMOVE_NON_MANIF_VERT :
parlst.addParam(new RichFloat("VertDispRatio", 0, "Vertex Displacement Ratio", "When a vertex is split it is moved along the average vector going from its position to the baricyenter of the FF connected faces sharing it"));
break;
default: break; // do not add any parameter for the other filters
}
}
示例15: initParameterSet
// This function define the needed parameters for each filter. Return true if the filter has some parameters
// it is called every time, so you can set the default value of parameters according to the mesh
// For each parmeter you need to define,
// - the name of the parameter,
// - the string shown in the dialog
// - the default value
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
void FilterAutoalign::initParameterSet(QAction *action,MeshDocument & md/*m*/, RichParameterSet & parlst)
{
MeshModel *target;
switch(ID(action)) {
case FP_AUTOALIGN :
target= md.mm();
foreach (target, md.meshList)
if (target != md.mm()) break;
parlst.addParam(new RichMesh ("FirstMesh", md.mm(),&md, "First Mesh",
"The mesh were the coplanar bases are sampled (it will contain the trasformation)"));
parlst.addParam(new RichMesh ("SecondMesh", target,&md, "Second Mesh",
"The mesh were similar coplanar based are searched."));
parlst.addParam(new RichFloat("overlapping",0.5f,"Estimated fraction of the\n first mesh overlapped by the second"));
parlst.addParam(new RichFloat("tolerance [0.0,1.0]",0.3f,"Error tolerance"));
break;
case FP_BEST_ROTATION :
target= md.mm();
foreach (target, md.meshList)
if (target != md.mm()) break;
parlst.addParam(new RichMesh ("FirstMesh", md.mm(),&md, "First Mesh",
"The mesh that will be moved"));
parlst.addParam(new RichMesh ("SecondMesh", target,&md, "Second Mesh",
"The mesh that will be kept fixed."));
parlst.addParam(new RichInt("GridSize",10,"Grid Size", "The size of the uniform grid that is used for searching the best translation for a given rotation"));
parlst.addParam(new RichInt("Rotation Num",64,"RotationNumber", "sss"));
break;
default: break; // do not add any parameter for the other filters
}
}