Skip to content
Browse files

Merge pull request #2 from reimai/master

fixed a bug with lPickSeeds peeking two nulls
  • Loading branch information...
2 parents 25ebc2e + bfe98a5 commit e602eb06fda7e6b42ec1cf82c813c1ed773a1760 @rweeks committed Feb 22, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/com/newbrightidea/util/RTree.java
View
4 src/com/newbrightidea/util/RTree.java
@@ -530,6 +530,7 @@ private Node qPickNext(LinkedList<Node> cc, Node[] nn)
{
@SuppressWarnings("unchecked")
RTree<T>.Node[] bestPair = new RTree.Node[2];
+ boolean foundBestPair = false;
float bestSep = 0.0f;
for (int i = 0; i < numDims; i++)
{
@@ -564,12 +565,13 @@ private Node qPickNext(LinkedList<Node> cc, Node[] nn)
bestPair[0] = nMaxLb;
bestPair[1] = nMinUb;
bestSep = sep;
+ foundBestPair = true;
}
}
// In the degenerate case where all points are the same, the above
// algorithm does not find a best pair. Just pick the first 2
// children.
- if ( bestPair == null )
+ if ( !foundBestPair )
{
bestPair = new RTree.Node[] { nn.get(0), nn.get(1) };
}

0 comments on commit e602eb0

Please sign in to comment.
Something went wrong with that request. Please try again.