Skip to content

Commit 1b9c216

Browse files
committed
Handle empty soup case
1 parent c9f0444 commit 1b9c216

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/nxsbuild/kdtree.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ void KDTreeSoup::clear() {
260260
void KDTreeSoup::findRealMiddle(KDCell &node) {
261261
Soup soup = get(node.block);
262262

263+
// Handle empty soup case - use node box center as fallback
264+
if(soup.size() == 0) {
265+
node.split = node.box.MaxDim();
266+
node.middle = node.box.Center()[node.split];
267+
return;
268+
}
269+
263270
vcg::Box3f box;
264271
for(quint32 i = 0; i < soup.size(); i++) {
265272
Triangle &triangle = soup[i];

0 commit comments

Comments
 (0)