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


C++ AxisAlignedBox::addInternalPoint方法代码示例

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


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

示例1: constructOctree

	void COctreeTriangleSelector::constructOctree(SOctreeNode* node)
	{
		++NodeCount;

		node->Box.reset(node->Triangles[0].pointA);

		// get bounding box
		const UINT32 cnt = node->Triangles.size();
		for (UINT32 i = 0; i<cnt; ++i)
		{
			node->Box.addInternalPoint(node->Triangles[i].pointA);
			node->Box.addInternalPoint(node->Triangles[i].pointB);
			node->Box.addInternalPoint(node->Triangles[i].pointC);
		}

		const Vector3& middle = node->Box.getCenter();
		//Vector3 edges[8];
		const Vector3* edges;
		//node->Box.getEdges(edges);
		//注意环绕顺序,Sapphire右手坐标系
		edges = node->Box.getAllCorners();

		AxisAlignedBox box;
		vector<triangle3df>::type keepTriangles;

		// 计算子节点

		//if (!node->Box.isEmpty() && (SINT32)node->Triangles.size() > MinimalPolysPerNode)
		if (!node->Box.isNull() && !node->Box.isInfinite() && (SINT32)node->Triangles.size() > MinimalPolysPerNode)
			for (SINT32 ch = 0; ch<8; ++ch)
			{
				box.reset(middle);
				box.addInternalPoint(edges[ch]);
				node->Child[ch] = new SOctreeNode();

				for (SINT32 i = 0; i<(SINT32)node->Triangles.size(); ++i)
				{
					if (node->Triangles[i].isTotalInsideBox(box))
					{
						node->Child[ch]->Triangles.push_back(node->Triangles[i]);
						//node->Triangles.erase(i);
						//--i;
					}
					else
					{
						keepTriangles.push_back(node->Triangles[i]);
					}
				}
				//memcpy(node->Triangles.pointer(), keepTriangles.pointer(),
					//sizeof(triangle3df)*keepTriangles.size());
				std::copy(node->Triangles.begin(), node->Triangles.begin() + node->Triangles.size(), keepTriangles.begin());
				//memcpy(node->Triangles.begin()._Ptr, keepTriangles.begin()._Ptr,
				//sizeof(triangle3df)*keepTriangles.size());

				//node->Triangles.set_used(keepTriangles.size());
				//keepTriangles.set_used(0);

				if (node->Child[ch]->Triangles.empty())
				{
					delete node->Child[ch];
					node->Child[ch] = 0;
				}
				else
					constructOctree(node->Child[ch]);
			}
	}
开发者ID:zxycode007,项目名称:Sapphire,代码行数:66,代码来源:SapphireCOctreeTriangleSelector.cpp


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