本文整理汇总了C++中QuadTree::GetCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ QuadTree::GetCenter方法的具体用法?C++ QuadTree::GetCenter怎么用?C++ QuadTree::GetCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuadTree
的用法示例。
在下文中一共展示了QuadTree::GetCenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetQuadrant
/**\brief Returns QuadTree at Coordinate
* \param point Coordinate
*/
QuadTree* SpriteManager::GetQuadrant( Coordinate point ) {
Coordinate treeCenter = GetQuadrantCenter(point);
// Check in the known Quadrant
map<Coordinate,QuadTree*>::iterator iter;
iter = trees.find( treeCenter );
if( iter != trees.end() ) {
return iter->second;
}
// Create the new Tree and attach it to the universe
QuadTree *newTree = new QuadTree(treeCenter, QUADRANTSIZE);
assert(treeCenter == newTree->GetCenter() );
assert(newTree->Contains(point));
trees.insert(make_pair(treeCenter, newTree));
AdjustBoundaries();
// Debug
//cout<<"A Tree at "<<treeCenter<<" was created to contain "<<point<<". "<<trees.size()<<" Quadrants exist now."<<endl;
return newTree;
}