本文整理汇总了C++中Tracker::current方法的典型用法代码示例。如果您正苦于以下问题:C++ Tracker::current方法的具体用法?C++ Tracker::current怎么用?C++ Tracker::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker
的用法示例。
在下文中一共展示了Tracker::current方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLightImplicitDigitalSurface
//-----------------------------------------------------------------------------
// Testing LightImplicitDigitalSurface
//-----------------------------------------------------------------------------
bool testLightImplicitDigitalSurface()
{
using namespace Z3i;
typedef ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
typedef LightImplicitDigitalSurface<KSpace,ImplicitDigitalEllipse> Boundary;
typedef Boundary::SurfelConstIterator ConstIterator;
typedef Boundary::Tracker Tracker;
typedef Boundary::Surfel Surfel;
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "Testing block ... LightImplicitDigitalSurface" );
Point p1( -10, -10, -10 );
Point p2( 10, 10, 10 );
KSpace K;
nbok += K.init( p1, p2, true ) ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "K.init() is ok" << std::endl;
ImplicitDigitalEllipse ellipse( 6.0, 4.5, 3.4 );
Surfel bel = Surfaces<KSpace>::findABel( K, ellipse, 10000 );
Boundary boundary( K, ellipse,
SurfelAdjacency<KSpace::dimension>( true ), bel );
unsigned int nbsurfels = 0;
for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
it != it_end; ++it )
{
++nbsurfels;
}
trace.info() << nbsurfels << " surfels found." << std::endl;
trace.beginBlock ( "Checks if adjacent surfels are part of the surface." );
for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
it != it_end; ++it )
{
Tracker* ptrTracker = boundary.newTracker( *it );
Surfel s = ptrTracker->current();
Dimension trackDir = * K.sDirs( s );
Surfel s1, s2;
// unsigned int m1 =
ptrTracker->adjacent( s1, trackDir, true );
// unsigned int m2 =
ptrTracker->adjacent( s2, trackDir, false );
// trace.info() << "s = " << s << std::endl;
// trace.info() << "s1 = " << s1 << " m1 = " << m1 << std::endl;
// trace.info() << "s2 = " << s2 << " m2 = " << m2 << std::endl;
nb++, nbok += boundary.isInside( s1 ) ? 1 : 0;
// trace.info() << "(" << nbok << "/" << nb << ") "
// << "boundary.isInside( s1 )" << std::endl;
nb++, nbok += boundary.isInside( s2 ) ? 1 : 0;
// trace.info() << "(" << nbok << "/" << nb << ") "
// << "boundary.isInside( s2 )" << std::endl;
delete ptrTracker;
}
trace.info() << "(" << nbok << "/" << nb << ") isInside tests." << std::endl;
trace.endBlock();
trace.endBlock();
return nbok == nb;
}
示例2: testDigitalSetBoundary
/**
* Example of a test. To be completed.
*
*/
bool testDigitalSetBoundary()
{
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "Testing block ... DigitalSetBoundary" );
using namespace Z2i;
typedef DigitalSetBoundary<KSpace,DigitalSet> Boundary;
typedef Boundary::SurfelConstIterator ConstIterator;
typedef Boundary::Tracker Tracker;
typedef Boundary::Surfel Surfel;
Point p1( -10, -10 );
Point p2( 10, 10 );
Domain domain( p1, p2 );
DigitalSet dig_set( domain );
Shapes<Domain>::addNorm2Ball( dig_set, Point( 0, 0 ), 5 );
Shapes<Domain>::removeNorm2Ball( dig_set, Point( 0, 0 ), 1 );
KSpace K;
nbok += K.init( domain.lowerBound(), domain.upperBound(), true ) ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "K.init() is ok" << std::endl;
Boundary boundary( K, dig_set );
unsigned int nbsurfels = 0;
for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
it != it_end; ++it )
{
++nbsurfels;
}
trace.info() << nbsurfels << " surfels found." << std::endl;
nb++, nbok += nbsurfels == ( 12 + 44 ) ? 1 : 0;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "nbsurfels == (12 + 44 )" << std::endl;
for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
it != it_end; ++it )
{
Tracker* ptrTracker = boundary.newTracker( *it );
Surfel s = ptrTracker->current();
Dimension trackDir = * K.sDirs( s );
Surfel s1, s2;
unsigned int m1 = ptrTracker->adjacent( s1, trackDir, true );
unsigned int m2 = ptrTracker->adjacent( s2, trackDir, false );
trace.info() << "s = " << s << std::endl;
trace.info() << "s1 = " << s1 << " m1 = " << m1 << std::endl;
trace.info() << "s2 = " << s2 << " m2 = " << m2 << std::endl;
nb++, nbok += boundary.isInside( s1 ) ? 1 : 0;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "boundary.isInside( s1 )" << std::endl;
nb++, nbok += boundary.isInside( s2 ) ? 1 : 0;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "boundary.isInside( s2 )" << std::endl;
delete ptrTracker;
}
trace.endBlock();
return nbok == nb;
}