Skip to content

Commit

Permalink
Fix the quadraticSplit, so that it can't pick the same node for both …
Browse files Browse the repository at this point in the history
…sides of a split.
  • Loading branch information
Infiniverse committed Sep 3, 2015
1 parent ec14dab commit f03c67d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java
Expand Up @@ -614,9 +614,11 @@ private Node quadraticSplit(Node indexNode, RelationshipType relationshipType) {
Node seed1 = null;
Node seed2 = null;
double worst = Double.NEGATIVE_INFINITY;
for (Node e : entries) {
for (int i = 0; i < entries.size(); ++i) {
Node e = entries.get(i);
Envelope eEnvelope = getChildNodeEnvelope(e, relationshipType);
for (Node e1 : entries) {
for (int j = i + 1; j < entries.size(); ++j) {
Node e1 = entries.get(j);
Envelope e1Envelope = getChildNodeEnvelope(e1, relationshipType);
double deadSpace = getArea(createEnvelope(eEnvelope, e1Envelope)) - getArea(eEnvelope) - getArea(e1Envelope);
if (deadSpace > worst) {
Expand Down

0 comments on commit f03c67d

Please sign in to comment.