From 5e4a893af11fa3aa34fae737d070a5eeb53f7f64 Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Sun, 7 Aug 2022 23:38:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86Boud=E7=9A=84?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ArchitectureColoredPainting/BvhTree.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArchitectureColoredPainting/BvhTree.cpp b/ArchitectureColoredPainting/BvhTree.cpp index e537e29..907ee25 100644 --- a/ArchitectureColoredPainting/BvhTree.cpp +++ b/ArchitectureColoredPainting/BvhTree.cpp @@ -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);