当前位置: 首页>>代码示例>>C++>>正文


C++ QuadTree::getBoundary方法代码示例

本文整理汇总了C++中QuadTree::getBoundary方法的典型用法代码示例。如果您正苦于以下问题:C++ QuadTree::getBoundary方法的具体用法?C++ QuadTree::getBoundary怎么用?C++ QuadTree::getBoundary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QuadTree的用法示例。


在下文中一共展示了QuadTree::getBoundary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vertices

vector<Vector2> GDIQuadTree::getVertices(const QuadTree& quadTree) const
{
	if (quadTree.getChildren().empty())
	{
		vector<Vector2> vertices(5, Vector2());

		vertices.at(0).X() = quadTree.getBoundary().center.X() - quadTree.getBoundary().halfDimension;
		vertices.at(0).Y() = quadTree.getBoundary().center.Y() + quadTree.getBoundary().halfDimension;
		vertices.at(1).X() = quadTree.getBoundary().center.X() + quadTree.getBoundary().halfDimension;
		vertices.at(1).Y() = quadTree.getBoundary().center.Y() + quadTree.getBoundary().halfDimension;
		vertices.at(2).X() = quadTree.getBoundary().center.X() + quadTree.getBoundary().halfDimension;
		vertices.at(2).Y() = quadTree.getBoundary().center.Y() - quadTree.getBoundary().halfDimension;
		vertices.at(3).X() = quadTree.getBoundary().center.X() - quadTree.getBoundary().halfDimension;
		vertices.at(3).Y() = quadTree.getBoundary().center.Y() - quadTree.getBoundary().halfDimension;
		vertices.at(4).X() = quadTree.getBoundary().center.X() - quadTree.getBoundary().halfDimension;
		vertices.at(4).Y() = quadTree.getBoundary().center.Y() + quadTree.getBoundary().halfDimension;

		return vertices;
	}

	vector<Vector2> vertices;

	for (unsigned int index = 0; index < quadTree.getChildren().size(); index++)
	{
		vector<Vector2> childVertices = getVertices(*quadTree.getChildren().at(index));
		vertices.insert(vertices.end(), childVertices.begin(), childVertices.end());
	}

	return vertices;
}
开发者ID:simplegsb,项目名称:gazengine,代码行数:30,代码来源:GDIQuadTree.cpp


注:本文中的QuadTree::getBoundary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。