Merge
commit
950a6d7526
|
@ -20,7 +20,7 @@ QVector4D BvhTree::Union(QVector4D a, QVector4D b) {
|
|||
|
||||
QVector4D BvhTree::calcBound(QVector4D initBound[], int l, int r) {
|
||||
QVector4D res = initBound[l];
|
||||
for (int i = l + 1; i < r; i++) {
|
||||
for (int i = l + 1; i <= r; i++) {
|
||||
res = Union(res, initBound[i]);
|
||||
}
|
||||
return res;
|
||||
|
@ -34,9 +34,9 @@ bvhPtr BvhTree::subBvhTree(QVector4D initBound[], int l, int r) {
|
|||
if (l == r) return p;
|
||||
int dim = p.get()->maximumBound();
|
||||
if (dim == 0) {
|
||||
std::sort(initBound + l, initBound + r, BvhNode::x_compare);
|
||||
std::sort(initBound + l, initBound + r+1, BvhNode::x_compare);
|
||||
} else {
|
||||
std::sort(initBound + l, initBound + r, BvhNode::y_compare);
|
||||
std::sort(initBound + l, initBound + r+1, BvhNode::y_compare);
|
||||
}
|
||||
int mid = (l + r) >> 1;
|
||||
p.get()->child[0] = subBvhTree(initBound, l, mid);
|
||||
|
|
Loading…
Reference in New Issue