本文整理汇总了C++中GridCurve::getArrowsRange方法的典型用法代码示例。如果您正苦于以下问题:C++ GridCurve::getArrowsRange方法的具体用法?C++ GridCurve::getArrowsRange怎么用?C++ GridCurve::getArrowsRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridCurve
的用法示例。
在下文中一共展示了GridCurve::getArrowsRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vlow
bool
lengthEstimators( const std::string & /*name*/,
Shape & aShape,
double h )
{
// Types
typedef typename Space::Point Point;
typedef typename Space::Vector Vector;
typedef typename Space::RealPoint RealPoint;
typedef typename Space::Integer Integer;
typedef HyperRectDomain<Space> Domain;
typedef KhalimskySpaceND<Space::dimension,Integer> KSpace;
typedef typename KSpace::SCell SCell;
typedef typename GridCurve<KSpace>::PointsRange PointsRange;
typedef typename GridCurve<KSpace>::ArrowsRange ArrowsRange;
// Digitizer
GaussDigitizer<Space,Shape> dig;
dig.attach( aShape ); // attaches the shape.
Vector vlow(-1,-1); Vector vup(1,1);
dig.init( aShape.getLowerBound()+vlow, aShape.getUpperBound()+vup, h );
Domain domain = dig.getDomain();
// Create cellular space
KSpace K;
bool ok = K.init( dig.getLowerBound(), dig.getUpperBound(), true );
if ( ! ok )
{
std::cerr << "[lengthEstimators]"
<< " error in creating KSpace." << std::endl;
return false;
}
try {
// Extracts shape boundary
SurfelAdjacency<KSpace::dimension> SAdj( true );
SCell bel = Surfaces<KSpace>::findABel( K, dig, 10000 );
// Getting the consecutive surfels of the 2D boundary
std::vector<Point> points;
Surfaces<KSpace>::track2DBoundaryPoints( points, K, SAdj, dig, bel );
// Create GridCurve
GridCurve<KSpace> gridcurve;
gridcurve.initFromVector( points );
// Ranges
ArrowsRange ra = gridcurve.getArrowsRange();
PointsRange rp = gridcurve.getPointsRange();
// Estimations
typedef typename PointsRange::ConstIterator ConstIteratorOnPoints;
typedef ParametricShapeArcLengthFunctor< Shape > Length;
TrueGlobalEstimatorOnPoints< ConstIteratorOnPoints, Shape, Length > trueLengthEstimator;
trueLengthEstimator.init( h, rp.begin(), rp.end(), &aShape, gridcurve.isClosed());
L1LengthEstimator< typename ArrowsRange::ConstCirculator > l1length;
DSSLengthEstimator< typename PointsRange::ConstCirculator > DSSlength;
MLPLengthEstimator< typename PointsRange::ConstIterator > MLPlength;
FPLengthEstimator< typename PointsRange::ConstIterator > FPlength;
BLUELocalLengthEstimator< typename ArrowsRange::ConstIterator > BLUElength;
RosenProffittLocalLengthEstimator< typename ArrowsRange::ConstIterator > RosenProffittlength;
// Output
double trueValue = trueLengthEstimator.eval();
double l1, blue, rosen,dss,mlp,fp;
double Tl1, Tblue, Trosen,Tdss,Tmlp,Tfp;
Clock c;
//Length evaluation & timing
c.startClock();
l1length.init(h, ra.c(), ra.c());
l1 = l1length.eval();
Tl1 = c.stopClock();
c.startClock();
BLUElength.init(h, ra.begin(), ra.end(), gridcurve.isClosed());
blue = BLUElength.eval();
Tblue = c.stopClock();
c.startClock();
RosenProffittlength.init(h, ra.begin(), ra.end(), gridcurve.isClosed());
rosen = RosenProffittlength.eval();
Trosen = c.stopClock();
c.startClock();
DSSlength.init(h, rp.c(), rp.c());
dss = DSSlength.eval();
Tdss = c.stopClock();
c.startClock();
MLPlength.init(h, rp.begin(), rp.end(), gridcurve.isClosed());
mlp = MLPlength.eval();
Tmlp = c.stopClock();
c.startClock();
FPlength.init(h, rp.begin(), rp.end(), gridcurve.isClosed());
fp = FPlength.eval();
Tfp = c.stopClock();
std::cout << std::setprecision( 15 ) << h << " " << rp.size() << " " << trueValue
<< " " << l1
//.........这里部分代码省略.........
示例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;
}