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


C++ TPoint::dot方法代码示例

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


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

示例1: general_opt


//.........这里部分代码省略.........
    ballCenter[2] = (int) paramBallArea[3];
  }

  
  if(vm.count("filterVisiblePart")){
    std::vector<double> vectNormalAndAngle;  
    theMaxAngle =vm["filterVisiblePart"].as<double>();
    aNormal[0] = vm["nx"].as<double>();
    aNormal[1] = vm["ny"].as<double>();
    aNormal[2] = vm["nz"].as<double>();
    aNormal /= aNormal.norm();
  }
  if(vm.count("filterNbFaces")){
    double percent = vm["filterNbFaces"].as<double>();
    moduloLimitFace = (int)(100.0/percent);
  } 
  

  DGtal::Mesh<Z3i::RealPoint> theMesh(true);
  MeshReader<Z3i::RealPoint>::importOFFFile(inputMeshName, theMesh, false);
  DGtal::Mesh<Z3i::RealPoint> theNewMesh(true);

  
  trace.info()<< "reading the input mesh ok: "<< theMesh.nbVertex() <<  std::endl;
  
  
  for (DGtal::Mesh<Z3i::RealPoint>::VertexStorage::const_iterator it = theMesh.vertexBegin();
       it != theMesh.vertexEnd(); it++){
    theNewMesh.addVertex(*it);
  }
  unsigned int numMaxFaces = theMesh.nbFaces();
  if (vm.count("filterFirstFaces"))
    {
      double percentFirst = vm["filterFirstFaces"].as<unsigned int>();
      numMaxFaces = (numMaxFaces/100.0)*percentFirst;
    }
  unsigned int num =0;
  for (DGtal::Mesh<Z3i::RealPoint>::FaceStorage::const_iterator it = theMesh.faceBegin();  
       it!= theMesh.faceEnd(); it++){
    num++;
    if(num>numMaxFaces){
      break;
    }
    DGtal::Mesh<Z3i::RealPoint>::MeshFace aFace = *it;
    bool okOrientation = true;
    TPoint p0 = theMesh.getVertex(aFace.at(1));
    TPoint p1 = theMesh.getVertex(aFace.at(0));
    TPoint p2 = theMesh.getVertex(aFace.at(2));
    TPoint vectNormal = ((p1-p0).crossProduct(p2 - p0)).getNormalized();    
    vectNormal /= vectNormal.norm();
    if (vm.count("filterVisiblePart")){
      okOrientation = vectNormal.dot(aNormal) > cos(theMaxAngle);
    }
    if( okOrientation && (!vm.count("filterNbFaces") || num%moduloLimitFace == 0 )){
      theNewMesh.addFace(aFace);
    }
    if( vm.count("shrinkBallArea")){
      TPoint ptCenter = (p0+p1+p2)/3.0;
      if((ptCenter-ballCenter).norm() <= radius){
        for(unsigned int i =0; i<3; i++){
          TPoint &aVertex = theNewMesh.getVertex(aFace.at(i));
          if(aVertex==theMesh.getVertex(aFace.at(i))){
            aVertex-=vectNormal*distanceShrink;
          }
        }        
      } 
    }

    if( vm.count("shrinkArea")){
      Z3i::Domain aDomain(ptLower, ptUpper);
      TPoint ptCenter = (p0+p1+p2)/3.0;
      if(aDomain.isInside(ptCenter)){
        for(unsigned int i =0; i<3; i++){
          TPoint &aVertex = theNewMesh.getVertex(aFace.at(i));
          if(aVertex==theMesh.getVertex(aFace.at(i))){
            aVertex-=vectNormal*distanceShrink;
          }
        }
      }
    }
    
  }  

  if(vm.count("scale"))
    {
      double scale = vm["scale"].as<double>();
      for(unsigned int i =0; i<theNewMesh.nbVertex(); i++)
        {
          theNewMesh.getVertex(i) *= scale;
 
        }
    }
  trace.info()<< "nbFaces init: " << theNewMesh.nbFaces() << std::endl;
  trace.info()<< "New nbFaces: " << theMesh.nbFaces() << std::endl;  
  std::ofstream outMesh;
  outMesh.open(outputMeshName.c_str(), std::ofstream::out);
  MeshWriter<Z3i::RealPoint>::export2OFF(outMesh, theNewMesh);
  

}
开发者ID:rolanddenis,项目名称:DGtalTools-contrib,代码行数:101,代码来源:basicEditMesh.cpp


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