Search in sources :

Example 16 with ModifiableHyperBoundingBox

use of de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox in project elki by elki-project.

the class AbstractRStarTreeNode method adjustEntry.

/**
 * Adjusts the parameters of the entry representing this node.
 *
 * @param entry the entry representing this node
 */
public boolean adjustEntry(E entry) {
    final SpatialDirectoryEntry se = (SpatialDirectoryEntry) entry;
    final ModifiableHyperBoundingBox mbr = computeMBR();
    boolean changed = false;
    if (se.hasMBR()) {
        final int dim = se.getDimensionality();
        // Test for changes
        for (int i = 0; i < dim; i++) {
            if (Math.abs(se.getMin(i) - mbr.getMin(i)) > Float.MIN_NORMAL) {
                changed = true;
                break;
            }
            if (Math.abs(se.getMax(i) - mbr.getMax(i)) > Float.MIN_NORMAL) {
                changed = true;
                break;
            }
        }
    } else {
        // No preexisting MBR.
        changed = true;
    }
    if (changed) {
        se.setMBR(mbr);
    }
    return changed;
}
Also used : SpatialDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry) ModifiableHyperBoundingBox(de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox)

Example 17 with ModifiableHyperBoundingBox

use of de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox in project elki by elki-project.

the class FlatRStarTree method createEmptyRoot.

@Override
protected void createEmptyRoot(SpatialEntry exampleLeaf) {
    root = createNewDirectoryNode();
    root.setPageID(getRootID());
    getFile().setNextPageID(getRootID() + 1);
    FlatRStarTreeNode leaf = createNewLeafNode();
    writeNode(leaf);
    ModifiableHyperBoundingBox mbr = new ModifiableHyperBoundingBox(new double[exampleLeaf.getDimensionality()], new double[exampleLeaf.getDimensionality()]);
    root.addDirectoryEntry(new SpatialDirectoryEntry(leaf.getPageID(), mbr));
    setHeight(2);
}
Also used : SpatialDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry) ModifiableHyperBoundingBox(de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox)

Aggregations

ModifiableHyperBoundingBox (de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox)17 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)3 SpatialDirectoryEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry)3 ArrayList (java.util.ArrayList)3 Random (java.util.Random)3 NumberVector (de.lmu.ifi.dbs.elki.data.NumberVector)2 LPNormDistanceFunction (de.lmu.ifi.dbs.elki.distance.distancefunction.minkowski.LPNormDistanceFunction)2 SpatialEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)2 SpatialPointLeafEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry)2 AbortException (de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)2 DoubleIntPair (de.lmu.ifi.dbs.elki.utilities.pairs.DoubleIntPair)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 HyperBoundingBox (de.lmu.ifi.dbs.elki.data.HyperBoundingBox)1 Logging (de.lmu.ifi.dbs.elki.logging.Logging)1 FiniteProgress (de.lmu.ifi.dbs.elki.logging.progress.FiniteProgress)1 Heap (de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap)1 TopBoundedHeap (de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TopBoundedHeap)1 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1