本文整理汇总了C++中CLine::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ CLine::Next方法的具体用法?C++ CLine::Next怎么用?C++ CLine::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLine
的用法示例。
在下文中一共展示了CLine::Next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _AddPathPortion
void COptimizePath::_AddPathPortion(CLine& line, const A3DPOINT2& dest, const int newCount)
{
int index;
int old_count = 0;
for (index = m_CurIndex +1; index < (int)m_Path.size(); index++)
{
old_count++;
//clear the old footprint
int x, y;
x = (int)m_Path[index].x;
y = (int)m_Path[index].y;
SetFootprint(x, y, 0);
if (x == dest.x && y == dest.y)
{
break;
}
}
assert(index < (int)m_Path.size() );
//adjust the path space between current to dest, have old_count, need newCount
if (old_count > newCount)
{
//erase
abase::vector<APointF>::iterator it1, it2;
it1 = &m_Path[m_CurIndex+1];
it2 = it1 + old_count - newCount;
m_Path.erase(it1, it2);
}
else if (old_count < newCount)
{
//insert
abase::vector<APointF>::iterator it1;
it1 = &m_Path[m_CurIndex+1];
m_Path.insert(it1, newCount - old_count, APointF());
}
//replace the old path portion
index = m_CurIndex+1;
while (line.GetCount() < newCount)
{
m_Path[index] = line.Next();
index++;
}
}
示例2: _LineTo
bool COptimizePath::_LineTo(CLine& line, APointF& to)
{
#define LOCAL_STRICT_LINE
A3DPOINT2 to_pt((int)to.x, (int)to.y);
A3DPOINT2 cur_pt((int)line.GetFrom().x, (int)line.GetFrom().y);
CMoveMap * pMoveMap = g_MoveAgentManager.GetMoveMap();
assert(pMoveMap);
#ifdef LOCAL_STRICT_LINE
A3DPOINT2 last_pt(cur_pt);
#endif
while (cur_pt != to_pt )
{
APointF cur(line.Next());
cur_pt.x = (int)cur.x;
cur_pt.y = (int)cur.y;
if (!pMoveMap->IsPosReachable(cur_pt))
{
return false;
}
#ifdef LOCAL_STRICT_LINE
if ((cur_pt.x != last_pt.x && cur_pt.y != last_pt.y)
&&(!pMoveMap->IsPosReachable(last_pt.x, cur_pt.y)
|| !pMoveMap->IsPosReachable(cur_pt.x, last_pt.y)) )
{
return false;
}
last_pt = cur_pt;
#endif
}
#undef LOCAL_STRICT_LINE
return true;
}