本文整理汇总了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]);
}
}