本文整理匯總了C++中Interval::getRange方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::getRange方法的具體用法?C++ Interval::getRange怎麽用?C++ Interval::getRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Interval
的用法示例。
在下文中一共展示了Interval::getRange方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: setCumulative
float SamplesRegular1::setCumulative
(
const Array<float>& histogram,
const Interval& xAxis,
const Interval& yAxis
)
{
const float total = setCumulative( histogram, xAxis );
if( (1 < getSize()) && (0.0f < total) )
{
const float scaling = yAxis.getRange() / total;
const float offset = yAxis.getLower();
setYAxis( scaling, offset );
}
else
{
setAll( yAxis.getLower() );
}
return total;
}
示例2: x
//.........這裏部分代碼省略.........
if( pOut && isVerbose ) *pOut << i1 << " " << s1 << " " << u <<
" " << b1 << " " << isOk_ << "\n";
}
{
h1.setAll( d );
const Array<float>& b1 = h1.getSamples();
for( dword j = b1.getLength(); j-- > 0; )
{
isOk_ &= d == b1[ j ];
}
if( pOut && isVerbose ) *pOut << b1 << " " << isOk_ << "\n";
}
if( pOut && isVerbose ) *pOut << "\n";
if( pOut ) *pOut << "commands : " <<
(isOk_ ? "--- succeeded" : "*** failed") << "\n\n";
isOk &= isOk_;
}
// queries
{
bool isOk_ = true;
static const float a = -22.5f;
static const float b = 1138.0f;
static const dword c = 3;
SamplesRegular1 h1;
{
h1.setSize( c );
const dword s1 = h1.getSize();
isOk_ &= c == s1;
if( pOut && isVerbose ) *pOut << s1 << " " << isOk_ << "\n";
}
{
h1.setXAxis( Interval(a, b) );
const Interval i1( h1.getXAxis() );
isOk_ &= Interval(a, b) == i1;
if( pOut && isVerbose ) *pOut << i1 << " " << isOk_ << "\n";
}
{
h1.setSize( 0 );
const float v1 = h1.getValue( 1.0f );
isOk_ &= 0.0f == v1;
Array<float> h( c );
h[0] = 1.0f;
h[1] = 3.0f;
h[2] = 4.0f;
const float s = h1.setCumulative( h, Interval(a, b) );
const float v2 = h1.getValue( -10000.0f );
const float v3 = h1.getValue( 10000.0f );
isOk_ &= 0.0f == v2;
isOk_ &= s == v3;
if( pOut && isVerbose ) *pOut << v1 << " " << v2 << " " << v3 <<
" " << isOk_ << "\n";
const Array<float>& b1 = h1.getSamples();
const Interval i1( h1.getXAxis() );
Array<float> vs( c );
Array<float> ps( c );
const float n = i1.getRange() / float(c);
float p = i1.getLower() + (n / 2.0f);
for( dword i = 0; i < c; ++i, p += n )
{
ps[i] = p;
vs[i] = h1.getValue( p );
isOk_ &= (b1[i] < vs[i]) & (b1[i + 1] > vs[i]);
}
if( pOut && isVerbose ) *pOut << b1 << " " << ps << " " << vs <<
" " << isOk_ << "\n";
}
if( pOut && isVerbose ) *pOut << "\n";
if( pOut ) *pOut << "queries : " <<
(isOk_ ? "--- succeeded" : "*** failed") << "\n\n";
isOk &= isOk_;
}
if( pOut ) *pOut << (isOk ? "--- successfully" : "*** failurefully") <<
" completed " << "\n\n\n";
if( pOut ) pOut->flush();
return isOk;
}