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


C++ Metric::hiddenByPower方法代码示例

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


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

示例1: testPowerMetrics

bool testPowerMetrics()
{
  unsigned int nbok = 0;
  unsigned int nb = 0;
  
  trace.beginBlock ( "Testing separable weighted metrics ..." );

  Z2i::Point a( 0,0), bbis(4, 1), b(5,0), bb(5,-10), bbb(5,5),c(10,0);
  Z2i::Point d(5,-6);
  Z2i::Point starting( 0, 5), endpoint(10,5);
  
  typedef ExactPredicateLpPowerSeparableMetric<Z2i::Space, 2> Metric;
  Metric metric;

  trace.info()<< "a= "<<a<<std::endl;
  trace.info()<< "b= "<<b<<std::endl;
  trace.info()<< "bb= "<<bb<<std::endl;
  trace.info()<< "bbb= "<<bbb<<std::endl;
  trace.info()<< "c= "<<c<<std::endl;
  trace.info()<< "d= "<<d<<std::endl;
  
  bool closer = (metric.closestPower(bbis,a,0,c,0) == DGtal::ClosestFIRST);  
  nbok += (closer) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "a is closer" << std::endl;

  closer = (metric.closestPower(bbis,a,10,c,35) == DGtal::ClosestFIRST);
  nbok += (!closer) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "c is closer with w_a=10 w_c=35" << std::endl;
  trace.endBlock();


  trace.beginBlock("Testing Hidden with w=0");
  bool hidden  =metric.hiddenByPower(a,0,b,0,c,0,starting,endpoint,0); 
  nbok += (!hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,b,c) returns false" << std::endl;
      
  hidden  =metric.hiddenByPower(a,0,bb,0,c,0,starting,endpoint,0); 
  nbok += (hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,bb,c) returns true" << std::endl;
  
  hidden  =metric.hiddenByPower(a,0,bbb,0,c,0,starting,endpoint,0); 
  nbok += (!hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,bbb,c) returns false" << std::endl;

  hidden  =metric.hiddenByPower(a,0,d,0,c,0,starting,endpoint,0); 
  nbok += (hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,d,c) returns true" << std::endl;
  trace.endBlock();

  trace.beginBlock("Testing Hidden with w!=0");

  hidden  =metric.hiddenByPower(a,0,d,30,c,0,starting,endpoint,0); 
  nbok += (hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,0,d,30,c,0) returns true" << std::endl;

  hidden  =metric.hiddenByPower(a,10,d,10,c,10,starting,endpoint,0); 
  nbok += (hidden) ? 1 : 0; 
  nb++;
  trace.info() << "(" << nbok << "/" << nb << ") "
	       << "(a,10,d,10,c,10) returns true" << std::endl;
  
  
  trace.endBlock();
  
  return nbok == nb;
}
开发者ID:arnaudetitia,项目名称:DGtal,代码行数:80,代码来源:testMetrics.cpp


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