bool testDomain() { typedef SpaceND<2> TSpace; typedef TSpace::Point Point; Point a ( 1, 1); Point b ( 15, 15); trace.beginBlock ( "HyperRectDomain Iterator" ); HyperRectDomain<TSpace> myDomain ( a,b ); Board2D board; board << SetMode( myDomain.className(), "Grid" ) << myDomain; board.scale(10); board.saveSVG( "domain-grid.svg" ); board.saveTikZ( "domain-grid.tikz" ); Board2D b2; b2 << SetMode( myDomain.className(), "Paving" ) << myDomain; b2.scale(10); b2.saveSVG( "domain-paving.svg" ); b2.saveTikZ( "domain-paving.tikz" ); trace.endBlock(); PointVector<3,int> pl; //An assert should be raised //Display2DFactory::draw(b2, pl); return true; }
bool testDomain() { typedef SpaceND<2> TSpace; typedef TSpace::Point Point; Point a ( 1, 1); Point b ( 15, 15); trace.beginBlock ( "HyperRectDomain Iterator" ); HyperRectDomain<TSpace> myDomain ( a,b ); Board2D board; board << DrawDomainGrid() << myDomain; board.scale(10); board.saveSVG( "domain-grid.svg" ); Board2D b2; b2 << DrawDomainPaving() << myDomain; b2.scale(10); b2.saveSVG( "domain-paving.svg" ); trace.endBlock(); PointVector<3,int> pl; //An assert should be raised //pl.selfDraw(b2); return true; }
/** * Example of a test. To be completed. * */ bool testSimpleBoard() { unsigned int nbok = 0; unsigned int nb = 2; trace.beginBlock ( "Testing class SimpleBoard" ); Board2D board; board.setPenColorRGBi( 0, 0, 0); board.drawRectangle( -1, 1, 2.0, 2.0 ); board.setPenColorRGBi( 0, 0, 255 ); board.fillCircle( 2, 2, 1 ); board.saveSVG( "simpleboard.svg" ); board.saveFIG( "simpleboard.fig" ); board.saveEPS( "simpleboard.eps" ); board.saveTikZ( "simpleboard.tikz" ); nbok++; typedef PointVector<2,int> Point2D; Point2D apoint, p2; apoint[0] = 5; p2[0] = 1; apoint[1] = 8; p2[1] = 1; board.setPenColorRGBi( 255, 0, 255 ); board << apoint; board.setPenColorRGBi( 255, 0, 0 ); Display2DFactory::draw(board, apoint, p2); board.scale(10); board.saveSVG( "pointsimpleboard.svg" ); board.saveFIG( "pointsimpleboard.fig" ); board.saveEPS( "pointsimpleboard.eps" ); board.saveTikZ( "pointsimpleboard.tikz" ); nbok++; trace.endBlock(); return nbok == nb; }
bool testDigitalSetDraw() { unsigned int nbok = 0; unsigned int nb = 0; typedef SpaceND<2> Z2; typedef HyperRectDomain<Z2> Domain; typedef Z2::Point Point; Point p1( -10, -10 ); Point p2( 10, 10 ); Domain domain( p1, p2 ); typedef DigitalSetSelector < Domain, BIG_DS + HIGH_ITER_DS + HIGH_BEL_DS >::Type SpecificSet; BOOST_CONCEPT_ASSERT(( concepts::CDigitalSet< SpecificSet > )); SpecificSet disk( domain ); Point c( 0, 0 ); trace.beginBlock ( "Creating disk( r=5.0 ) ..." ); for ( Domain::ConstIterator it = domain.begin(); it != domain.end(); ++it ) { if ( (*it - c ).norm() < 5.0 ) // insertNew is very important for vector container. disk.insertNew( *it ); } //Board export test trace.beginBlock("SVG Export"); Board2D board; board << SetMode( domain.className(), "Grid" ) << domain; board << disk; board.scale(10); board.saveSVG( "disk-set.svg" ); trace.endBlock(); return nbok == nb; }