本文整理汇总了C++中GridCurve::getInnerPointsRange方法的典型用法代码示例。如果您正苦于以下问题:C++ GridCurve::getInnerPointsRange方法的具体用法?C++ GridCurve::getInnerPointsRange怎么用?C++ GridCurve::getInnerPointsRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridCurve
的用法示例。
在下文中一共展示了GridCurve::getInnerPointsRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDisplayDTFromCircle
bool testDisplayDTFromCircle(int size)
{
static const DGtal::Dimension dimension = 2;
//Domain
typedef HyperRectDomain< SpaceND<dimension, int> > Domain;
typedef Domain::Point Point;
Domain d(Point::diagonal(-size), Point::diagonal(size));
DomainPredicate<Domain> dp(d);
//Image and set
typedef ImageContainerBySTLMap<Domain,double> Image;
typedef DigitalSetFromMap<Image> Set;
//Digital circle generation
typedef KhalimskySpaceND< dimension, int > KSpace;
GridCurve<KSpace> gc;
double radius = (rand()%size);
trace.info() << " #ball c(" << 0 << "," << 0 << ") r=" << radius << endl;
ballGenerator<KSpace>( size, 0, 0, radius, gc );
unsigned int nbok = 0;
unsigned int nb = 0;
double dmaxInt = 0;
trace.beginBlock ( "Interior " );
{
typedef BallPredicate<Point> Predicate;
typedef FMM<Image, Set, Predicate > FMM;
//init
Image map( d );
Set set(map);
GridCurve<KSpace>::InnerPointsRange r = gc.getInnerPointsRange();
FMM::initFromPointsRange(r.begin(), r.end(), map, set, 0.5);
//computation
Predicate bp(0,0,radius);
FMM fmm(map, set, bp);
fmm.compute();
trace.info() << fmm << std::endl;
nbok += (fmm.isValid()?1:0);
trace.info() << nbok << "/" << ++nb << std::endl;
//max
dmaxInt = fmm.getMax();
//display
std::stringstream s;
s << "DTInCircle-" << size;
draw(map.begin(), map.end(), size, s.str());
}
trace.endBlock();
double dmaxExt = 0;
trace.beginBlock ( "Exterior " );
{
typedef NotPointPredicate<BallPredicate<Point> > PointPredicate;
typedef BinaryPointPredicate<PointPredicate,
DomainPredicate<Domain> > Predicate;
typedef FMM<Image, Set, Predicate > FMM;
//init
Image map( d );
Set set(map);
GridCurve<KSpace>::OuterPointsRange r = gc.getOuterPointsRange();
FMM::initFromPointsRange(r.begin(), r.end(), map, set, 0.5);
//computation
BallPredicate<Point> bp(0,0,radius);
PointPredicate nbp( bp );
Predicate pred( nbp, dp, andBF2 );
FMM fmm(map, set, pred);
fmm.compute();
trace.info() << fmm << std::endl;
nbok += (fmm.isValid()?1:0);
trace.info() << nbok << "/" << ++nb << std::endl;
//max
dmaxExt = fmm.getMax();
//display
std::stringstream s;
s << "DTOutCircle-" << size;
draw(map.begin(), map.end(), size, s.str());
}
trace.endBlock();
double dmin = 0; //2*size*size;
double dmax = 0;
trace.beginBlock ( "Both " );
{
typedef DomainPredicate<Domain> Predicate;
typedef FMM<Image, Set, Predicate > FMM;
//init
Image map( d );
//.........这里部分代码省略.........
示例2: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Testing class GridCurve" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
std::string sinus2D4 = testPath + "samples/sinus2D4.dat";
std::string polyg2D = testPath + "samples/polyg2D.dat";
std::string sinus3D = testPath + "samples/sinus3D.dat";
std::string emptyFile = testPath + "samples/emptyFile.dat";
std::string square = testPath + "samples/smallSquare.dat";
typedef KhalimskySpaceND<2> K2;
typedef KhalimskySpaceND<3> K3;
///////// general tests
bool res = testIOGridCurve<K2>(sinus2D4)
&& testIOGridCurve<K3>(sinus3D)
&& testExceptions(sinus3D)
&& testExceptions(polyg2D)
&& testExceptions(emptyFile)
&& testDrawGridCurve(sinus2D4)
&& testIsOpen(sinus2D4,true)
&& testIsOpen(square,false);
/////////// ranges test
typedef GridCurve<K2> GridCurve;
testRangeConceptChecking<GridCurve::SCellsRange>();
testRangeConceptChecking<GridCurve::SCellsRange>();
testRangeConceptChecking<GridCurve::PointsRange>();
testRangeConceptChecking<GridCurve::MidPointsRange>();
testRangeConceptChecking<GridCurve::ArrowsRange>();
testRangeConceptChecking<GridCurve::InnerPointsRange>();
testRangeConceptChecking<GridCurve::OuterPointsRange>();
testRangeConceptChecking<GridCurve::IncidentPointsRange>();
//reading grid curve
GridCurve c;
fstream inputStream;
inputStream.open (square.c_str(), ios::in);
c.initFromVectorStream(inputStream);
inputStream.close();
res = res
&& testRange<GridCurve::SCellsRange>(c.getSCellsRange())
&& testRange<GridCurve::PointsRange>(c.getPointsRange())
&& testRange<GridCurve::MidPointsRange>(c.getMidPointsRange())
&& testPairsRange<GridCurve::ArrowsRange>(c.getArrowsRange())
&& testRange<GridCurve::InnerPointsRange>(c.getInnerPointsRange())
&& testRange<GridCurve::OuterPointsRange>(c.getOuterPointsRange())
&& testPairsRange<GridCurve::IncidentPointsRange>(c.getIncidentPointsRange())
&& testRange<GridCurve::CodesRange>(c.getCodesRange())
;
res = res
&& testDisplayRange<GridCurve::SCellsRange>(c.getSCellsRange())
&& testDisplayRange<GridCurve::PointsRange>(c.getPointsRange())
&& testDisplayRange<GridCurve::MidPointsRange>(c.getMidPointsRange())
&& testDisplayRange<GridCurve::ArrowsRange>(c.getArrowsRange())
&& testDisplayRange<GridCurve::InnerPointsRange>(c.getInnerPointsRange())
&& testDisplayRange<GridCurve::OuterPointsRange>(c.getOuterPointsRange())
&& testDisplayRange<GridCurve::IncidentPointsRange>(c.getIncidentPointsRange())
&& testDisplayRange<GridCurve::CodesRange>(c.getCodesRange())
;
res = res
&& testDrawRange<GridCurve::SCellsRange>(c.getSCellsRange(),"1cells","Grid")
&& testDrawRange<GridCurve::PointsRange>(c.getPointsRange(),"Points","Paving")
&& testDrawRange<GridCurve::MidPointsRange>(c.getMidPointsRange(),"MidPoints","Paving")
&& testDrawRange<GridCurve::ArrowsRange>(c.getArrowsRange(),"Arrows","Paving")
&& testDrawRange<GridCurve::InnerPointsRange>(c.getInnerPointsRange(),"InnerPoints","Grid")
&& testDrawRange<GridCurve::OuterPointsRange>(c.getOuterPointsRange(),"OuterPoints","Grid")
&& testDrawRange<GridCurve::IncidentPointsRange>(c.getIncidentPointsRange(),"IncidentPoints","Grid")
;
//////////////////////
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}