本文整理汇总了C++中PathNode::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ PathNode::GetParent方法的具体用法?C++ PathNode::GetParent怎么用?C++ PathNode::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathNode
的用法示例。
在下文中一共展示了PathNode::GetParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildPath
void Pathfinder::BuildPath(PathNode * lastNode) {
m_finalPath.clear();
m_edgesPath.clear();
//iterate over all node parents to get the full path
PathNode * node = lastNode;
USVec2D edgeDir;
USVec2D edgePos;
float edgeLength;
while (node->GetParent()) {
m_finalPath.push_back(node);
for (std::vector<Polygon::Edge>::iterator itr = node->GetPolygon()->m_edges.begin();
itr != node->GetPolygon()->m_edges.end(); ++itr) {
if (itr->m_neighbour == node->GetParent()->GetPolygon()) {
edgeDir = node->GetPolygon()->m_vertices[itr->m_verticesID[1]]
- node->GetPolygon()->m_vertices[itr->m_verticesID[0]];
edgeLength = edgeDir.Length();
edgePos = node->GetPolygon()->m_vertices[itr->m_verticesID[0]]
+ (edgeDir.NormVector() * (edgeLength / 2));
m_edgesPath.push_back(edgePos);
}
}
node = node->GetParent();
}
node = node;
}