From ced418ccb5b6728249cd0aa5a488deb65881c5a1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 3 Aug 2008 16:48:12 +0000 Subject: [PATCH] Moved bb expansion out of loop. --- src/osg/KdTree.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osg/KdTree.cpp b/src/osg/KdTree.cpp index 4af1f3b39..7628415d3 100644 --- a/src/osg/KdTree.cpp +++ b/src/osg/KdTree.cpp @@ -226,6 +226,10 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int node.bb.expandBy(v1); node.bb.expandBy(v2); + } + + if (node.bb.valid()) + { float epsilon = 1e-6; node.bb._min.x() -= epsilon; node.bb._min.y() -= epsilon; @@ -234,7 +238,7 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int node.bb._max.y() += epsilon; node.bb._max.z() += epsilon; } - + #ifdef VERBOSE_OUTPUT if (!node.bb.valid()) {