本文整理汇总了C++中SgPointSet::Border方法的典型用法代码示例。如果您正苦于以下问题:C++ SgPointSet::Border方法的具体用法?C++ SgPointSet::Border怎么用?C++ SgPointSet::Border使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgPointSet
的用法示例。
在下文中一共展示了SgPointSet::Border方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MergeAdjacentAndAddBlock
void GoRegionBoard::MergeAdjacentAndAddBlock(SgPoint move,
SgBlackWhite capturedColor)
{
SgVector<SgPoint> nb;
for (GoNbIterator it(Board(), move); it; ++it)
if (Board().IsEmpty(*it))
nb.PushBack(*it);
SgVectorOf<GoBlock> captures;
PreviousBlocksAt(nb, capturedColor, &captures);
SG_ASSERT(captures.NonEmpty());
SgPointSet captured;
{for (SgVectorIteratorOf<GoBlock> it(captures); it; ++it)
captured |= (*it)->Stones();
}
SgVectorOf<GoRegion> adj;
const int size = Board().Size();
RegionsAt(captured.Border(size), capturedColor, &adj);
SG_ASSERT(adj.NonEmpty());
GoRegion* r = MergeAll(adj, captured, capturedColor);
SG_UNUSED(r);
for (SgVectorIteratorOf<GoBlock> it(captures); it; ++it)
RemoveBlock(*it, true, false);
// don't remove from regions; already gone.
}
示例2: AllInsideLibs
// improved by using recursive extension to find 2-conn paths.
bool GoRegion::Find2ConnForAllInterior(SgMiaiStrategy* miaiStrategy,
SgVector<SgPoint>& usedLibs) const
{
SgVector<SgMiaiPair> myStrategy;
const int size = m_bd.Size();
SgPointSet interior = AllInsideLibs();
if (interior.IsEmpty())
{
return true;
}
//if (GetFlag(GO_REGION_SINGLE_BLOCK_BOUNDARY))
{
SgPointSet testSet = interior;
SgPointSet originalLibs = testSet.Border(size) & Dep().Border(size)
& m_bd.AllEmpty() & Points();
SgPointSet updateLibs = originalLibs;
// now try to find miai-paths to remaining interior points recursively
bool changed = true;
while (changed)
{
changed = false;
if (testSet.IsEmpty())
{
SgVector<SgPoint> jlibs;
JointLibs(&jlibs);
SgVector<SgPoint> ips;
GetIPs(&ips);
SgVector<SgMiaiPair> updateStrg;
for (SgSetIterator it(interior); it; ++it)
{
SgPoint p = *it;
SgPointSet s1;
s1.Include(p);
SgPointSet rest = s1.Border(size) & updateLibs;
if (! rest.IsEmpty())
{
for (SgVectorIterator<SgMiaiPair> it2(myStrategy);
it2; ++it2)
{
SgMiaiPair x = *it2;
if ( SgPointUtil::AreAdjacent(p, x.first)
&& SgPointUtil::AreAdjacent(p, x.second)
)
{
if (ips.Contains(x.first))
{
updateLibs.Include(x.first);
usedLibs.Exclude(x.first);
SgPoint t = rest.PointOf();
x.first = t;
updateLibs.Exclude(t);
rest.Exclude(t);
usedLibs.Include(t);
}
if ( ips.Contains(x.second)
&& ! rest.IsEmpty()
)
{
updateLibs.Include(x.second);
usedLibs.Exclude(x.second);
SgPoint t = rest.PointOf();
x.second = t;
updateLibs.Exclude(t);
rest.Exclude(t);
usedLibs.Include(t);
}
updateStrg.Include(x);
}
}
}
}
miaiStrategy->SetStrategy(updateStrg);
/* */ return true; /* */
}
for (SgSetIterator it(interior); it; ++it)
{
SgMiaiPair miaiPair;
if (Find2BestLibs(*it, updateLibs, testSet, &miaiPair))
{
if (miaiPair.first == miaiPair.second)
{
SgDebug() <<"\nmiaipair are same: "
<< SgWritePoint(miaiPair.first)
<< SgWritePoint(miaiPair.second);
SgDebug() <<"\ncurrent region is:\n";
Points().Write(SgDebug(), size);
SG_ASSERT(false);
}
myStrategy.PushBack(miaiPair);
usedLibs.PushBack(miaiPair.first);
usedLibs.PushBack(miaiPair.second);
updateLibs.Exclude(miaiPair.first);
updateLibs.Exclude(miaiPair.second);
updateLibs.Include(*it);
testSet.Exclude(*it);
changed = true;
}
//.........这里部分代码省略.........