本文整理汇总了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;
}