本文整理汇总了C++中cmesho::FacePointer::V0方法的典型用法代码示例。如果您正苦于以下问题:C++ FacePointer::V0方法的具体用法?C++ FacePointer::V0怎么用?C++ FacePointer::V0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmesho::FacePointer
的用法示例。
在下文中一共展示了FacePointer::V0方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SnapVertexBorder
//.........这里部分代码省略.........
unifGridFace.Set(m.face.begin(),m.face.end());
markerFunctor.SetMesh(&m);
int faceFound;
int K = 20;
Point3f startPt;
float maxDist = m.bbox.Diag()/20;
vector<Point3f> splitVertVec;
vector<CMeshO::FacePointer> splitFaceVec;
vector<int> splitEdgeVec;
for(CMeshO::VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
if(!(*vi).IsD() && (*vi).IsB())
{
int percPos = (tri::Index(m,*vi) *100) / m.vn;
cb(percPos,"Snapping vertices");
vector<CMeshO::FacePointer> faceVec;
vector<float> distVec;
vector<Point3f> pointVec;
Point3f u;
startPt = (*vi).P();
faceFound = unifGridFace.GetKClosest(PDistFunct,markerFunctor, K, startPt,maxDist, faceVec, distVec, pointVec);
CMeshO::FacePointer bestFace = 0;
float localThr, bestDist = std::numeric_limits<float>::max();
Point3f bestPoint;
int bestEdge;
// qDebug("Found %i face for vertex %i",faceFound,vi-m.vert.begin());
for(int i=0;i<faceFound;++i)
{
const float epsilonSmall = 1e-5;
const float epsilonBig = 1e-2;
CMeshO::FacePointer fp=faceVec[i];
InterpolationParameters(*fp,fp->cN(),pointVec[i],u);
// qDebug(" face %i face for vertex %5.3f %5.3f %5.3f dist %5.3f (%c %c %c)",fp-&*m.face.begin(),u[0],u[1],u[2],distVec[i],IsBorder(*fp,0)?'b':' ',IsBorder(*fp,1)?'b':' ',IsBorder(*fp,2)?'b':' ');
for(int j=0;j<3;++j)
{
if(IsBorder(*fp,j) && !fp->IsV())
{
if( u[(j+0)%3] > epsilonBig &&
u[(j+1)%3] > epsilonBig &&
u[(j+2)%3] < epsilonSmall )
{
if(distVec[i] < bestDist)
{
bestDist=distVec[i];
//bestPoint=pointVec[i];
bestPoint=(*vi).cP();
bestFace=fp;
bestEdge=j;
}
}
}
}
} // end for each faceFound
if(bestFace)
localThr = threshold*Distance(bestFace->P0(bestEdge),bestFace->P1(bestEdge));
if(bestDist < localThr && !bestFace->IsV())
{
bestFace->SetV();
(*vi).C()= Color4b::Blue;
//bestFace->C()=Color4b::LightBlue;
(*vi).SetS();
splitVertVec.push_back(bestPoint);
splitEdgeVec.push_back(bestEdge);
splitFaceVec.push_back(bestFace);
}
}
tri::Allocator<CMeshO>::PointerUpdater<CMeshO::FacePointer> pu;
CMeshO::VertexIterator firstVert = tri::Allocator<CMeshO>::AddVertices(m,splitVertVec.size());
CMeshO::FaceIterator firstface = tri::Allocator<CMeshO>::AddFaces(m,splitVertVec.size(),pu);
//
// ^ ^
// / \ / | \ .
// / \ / | \ .
// / \ / | \ .
// / fp \ / | \ .
// / \ / fp | ff \ .
// V0 ------------------V2 V0 -------fv---------V2
// i
for(size_t i=0;i<splitVertVec.size();++i)
{
firstVert->P() = splitVertVec[i];
int eInd = splitEdgeVec[i];
CMeshO::FacePointer fp = splitFaceVec[i];
pu.Update(fp);
firstface->V(0) = &*firstVert;
firstface->V(1) = fp->V2(eInd);
firstface->V(2) = fp->V0(eInd);
// firstface->C()=Color4b::LightBlue;
fp->V0(eInd) = &*firstVert;
++firstface;
++firstVert;
}
tri::UpdateNormal<CMeshO>::PerVertexNormalizedPerFaceNormalized(m);
return splitVertVec.size();
}