本文整理汇总了C++中KDTree::beginBoxIntersection方法的典型用法代码示例。如果您正苦于以下问题:C++ KDTree::beginBoxIntersection方法的具体用法?C++ KDTree::beginBoxIntersection怎么用?C++ KDTree::beginBoxIntersection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDTree
的用法示例。
在下文中一共展示了KDTree::beginBoxIntersection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBoxIntersect
static void testBoxIntersect() {
KDTree<Vector3> tree;
// Make a tree containing a regular grid of points
for (int x = -5; x <= 5; ++x) {
for (int y = -5; y <= 5; ++y) {
for (int z = -5; z <= 5; ++z) {
tree.insert(Vector3(x, y, z));
}
}
}
tree.balance();
AABox box(Vector3(-1.5, -1.5, -1.5), Vector3(1.5, 1.5, 1.5));
KDTree<Vector3>::BoxIntersectionIterator it = tree.beginBoxIntersection(box);
const KDTree<Vector3>::BoxIntersectionIterator end = tree.endBoxIntersection();
int hits = 0;
while (it != end) {
const Vector3& v = *it;
debugAssert(box.contains(v));
++hits;
++it;
}
debugAssertM(hits == 3*3*3, "Wrong number of intersections found in testBoxIntersect for KDTree");
}