当前位置: 首页>>代码示例>>C++>>正文


C++ FacePointer::V2方法代码示例

本文整理汇总了C++中cmesho::FacePointer::V2方法的典型用法代码示例。如果您正苦于以下问题:C++ FacePointer::V2方法的具体用法?C++ FacePointer::V2怎么用?C++ FacePointer::V2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmesho::FacePointer的用法示例。


在下文中一共展示了FacePointer::V2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DeleteCollinearBorder

  int  DeleteCollinearBorder(CMeshO &m, float threshold)
  {
    int total=0;
    CMeshO::FaceIterator fi;
    for(fi=m.face.begin();fi!=m.face.end();++fi)
      if(!(*fi).IsD())
        {
          for(int i=0;i<3;++i)
          {
            if(face::IsBorder(*fi,i) && !face::IsBorder(*fi,(i+1)%3))
            {
              CMeshO::VertexPointer V0= (*fi).V0(i);
              CMeshO::VertexPointer V1= (*fi).V1(i);
              CMeshO::VertexPointer V2=0;
              CMeshO::FacePointer fadj = (*fi).FFp((i+1)%3);
              int adjBordInd =  (*fi).FFi((i+1)%3);
              if(fadj->V1(adjBordInd) == V1)
                V2 = fadj->V2(adjBordInd);
              else
                continue; // non coerent face ordering.
              if(face::IsBorder(*fadj,(adjBordInd+1)%3))
              {
                // the colinearity test;
                Point3f pp;
                float dist;
                SegmentPointDistance(Segment3f(V0->cP(),V2->cP()),V1->cP(),pp,dist);
                if(dist* threshold <  Distance(V0->cP(),V2->cP()) )
                {
                  (*fi).V1(i)=V2;
                  if(face::IsBorder(*fadj,(adjBordInd+2)%3))
                  {
                    (*fi).FFp((i+1)%3)=&*fi;
                    (*fi).FFi((i+1)%3)=(i+1)%3;
                  }
                  else
                  {
                    CMeshO::FacePointer fj = fadj->FFp((adjBordInd+2)%3);
                    int ij = fadj->FFi((adjBordInd+2)%3);
                    (*fi).FFp((i+1)%3)= fj;
                    (*fi).FFi((i+1)%3)= ij;
                    fj->FFp(ij)=&*fi;
                    fj->FFi(ij)=(i+1)%3;
                  }
                  tri::Allocator<CMeshO>::DeleteFace(m,*fadj);
                  total++;
                }
              }
            }
          }
        }
	  return total;

}
开发者ID:yuhan120483,项目名称:dcba,代码行数:53,代码来源:cleanfilter.cpp

示例2: 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();
  }
开发者ID:yuhan120483,项目名称:dcba,代码行数:101,代码来源:cleanfilter.cpp


注:本文中的cmesho::FacePointer::V2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。