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


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

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


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

示例1: general_opt

int
main(int argc,char **argv)

{

  typedef typename Z3i::RealPoint TPoint;
  po::options_description general_opt("Allowed options are: ");
  general_opt.add_options()
    ("help,h", "display this message")
    ("input,i", po::value<std::string>(), "input file name of mesh vertex given as OFF format.")
    ("output,o", po::value<std::string>(),  "arg = file.off : export the resulting mesh associated to the fiber extraction.")
    ("shrinkArea,s", po::value<std::vector<double> >() ->multitoken(),  "arg = <dist> <bounding box> apply a mesh shrinking on the defined area.")
    ("shrinkBallArea,b", po::value<std::vector<double> >() ->multitoken(),  "arg = <dist> <x> <y> <z> <radius> apply a mesh shrinking on the  area defined by a ball centered at x y z.")
    ("filterVisiblePart", po::value< double >() , "arg = angle nx ny nz: filter the mesh visible part (according the mesh part in the direction  nx, ny, nz and a maximal angle)." )
    ("nx,x", po::value< double >() , "arg = angle nx ny nz: filter the mesh visible part (according the mesh part in the direction  nx, ny, nz and a maximal angle)." )
    ("ny,y", po::value< double >() , "arg = angle nx ny nz: filter the mesh visible part (according the mesh part in the direction  nx, ny, nz and a maximal angle)." 
     )    ("nz,z", po::value< double >() , "arg = angle nx ny nz: filter the mesh visible part (according the mesh part in the direction  nx,k ny, nz and a maximal angle)." )
    ("scale", po::value< double >() , "change the scale factor" )

    ("filterFirstFaces", po::value<unsigned int >(), "arg= X : filters the X% of the first faces of the input mesh." )
    ("filterNbFaces", po::value<double >() ->multitoken(), "arg = X % limits the number of face by keeping only X percent of faces." );

  bool parseOK=true;
  po::variables_map vm;
  try{
    po::store(po::parse_command_line(argc, argv, general_opt), vm);
  }catch(const std::exception& ex){
    trace.info()<< "Error checking program options: "<< ex.what()<< std::endl;
    parseOK=false;
  }
  po::notify(vm);
  if(vm.count("help")||argc<=1|| !parseOK )
    {
      trace.info()<< "Basic edit mesh " <<std::endl << "Options: "<<std::endl
		  << general_opt << "\n";
      return 0;
    }
  

  std::string inputMeshName = vm["input"].as<std::string>();
  std::string outputMeshName = vm["output"].as<std::string>();
  TPoint aNormal;
  double theMaxAngle;
  unsigned int moduloLimitFace;
  TPoint ptUpper, ptLower;
  double distanceShrink;
  if (vm.count("shrinkArea")){
    std::vector<double> vectDistAndBBox =  vm["shrinkArea"].as<std::vector<double> > ();
    distanceShrink = vectDistAndBBox[0];
    ptLower[0] = vectDistAndBBox[1];
    ptLower[1] = vectDistAndBBox[2];
    ptLower[2] = vectDistAndBBox[3];
    ptUpper[0] = vectDistAndBBox[4];
    ptUpper[1] = vectDistAndBBox[5];
    ptUpper[2] = vectDistAndBBox[6];
  }

  
  TPoint ballCenter;
  double  radius;
  if (vm.count("shrinkBallArea")){
    std::vector<double> paramBallArea =  vm["shrinkBallArea"].as<std::vector<double> > ();
    distanceShrink = paramBallArea[0];
    radius = paramBallArea[4];
    ballCenter[0] = (int) paramBallArea[1];
    ballCenter[1] = (int) paramBallArea[2];
    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>();
//.........这里部分代码省略.........
开发者ID:rolanddenis,项目名称:DGtalTools-contrib,代码行数:101,代码来源:basicEditMesh.cpp


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