本文整理汇总了C++中Space::contain方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::contain方法的具体用法?C++ Space::contain怎么用?C++ Space::contain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::contain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: query
static int query(Node *x, const Space &sp) {
if (!x)
return 0;
if (x->space.in(sp))
return x->sum;
if (x->space.out(sp))
return 0;
return query(x->NE, sp) + query(x->NW, sp) + query(x->SE, sp) +
query(x->SW, sp) + (sp.contain(*x->point) ? x->value : 0);
}
示例2: query
static int query(Node *x, const Space &sp) {
if (!x) {
return 0;
}
// printf("Querying (%d, %d)...\n", x->point->x, x->point->y);
if (x->space.out(sp)) {
puts("Out");
return 0;
} else if (x->space.in(sp)) {
puts("In");
return x->size;
} else {
return query(x->NE, sp) + query(x->NW, sp) + query(x->SE, sp) +
query(x->SW, sp) + (sp.contain(*(x->point)) ? 1 : 0);
}
}
示例3: operator
Family operator()( int color, const Space& sub )
{
Space base, margin;
Family adjs;
for ( typename Space::const_iterator it = base_.begin()
; it != base_.end(); ++it
)
{
typename Space::const_point pt( it );
if ( color_[ pt.index ] == color ) base.join( pt.element );
}
for ( typename Space::const_iterator it = base.begin()
; it != base.end(); ++it
)
{
typename Space::const_point pt0( it );
#ifdef ELAI_USE_C11
const Space&& adj = std::move( adjacent_( pt0.element ) );
#else
const Space adj = adjacent_( pt0.element );
#endif
Neighbour neigh( Element( pt0.element, color ) );
for ( typename Space::const_iterator jt = adj.begin()
; jt != adj.end(); ++jt
)
{
typename Space::const_point pt( jt );
const Element pt1( pt.element, color );
if ( !base.contain( pt.element ) && !margin.contain( pt.element ) )
margin.join( pt.element, Element( pt.element, color ) ); // ( BASE, RECOLORED )
if ( !sub.contain( pt1 ) ) continue;
neigh.join( pt1 );
}
adjs.join( neigh );
}
for ( typename Space::const_marginal_iterator it = margin.internal_begin()
; it != margin.internal_end(); ++it
)
{
typename Space::const_internal_point pt0( it );
#ifdef ELAI_USE_C11
const Space&& adj = std::move( adjacent_( pt0.element ) );
#else
const Space adj = adjacent_( pt0.internal ); // BASE ELEMENT
#endif
Neighbour neigh( pt0.external ); // RECOLORED ELEMENT
for ( typename Space::const_iterator jt = adj.begin(); jt != adj.end(); ++jt )
{
typename Space::const_point pt( jt );
const Element pt1( pt.element, color );
if ( !sub.contain( pt1 ) ) continue;
neigh.join( pt1 );
}
adjs.join( neigh );
}
return adjs;
}