Package de.lmu.ifi.dbs.elki.data.spatial

Examples of de.lmu.ifi.dbs.elki.data.spatial.SpatialComparable


    List<byte[]> zValuesList = ZCurve.zValues(valuesList);

    // map z-values
    final Map<SpatialComparable, byte[]> zValues = new HashMap<SpatialComparable, byte[]>();
    for(int i = 0; i < spatialObjects.size(); i++) {
      SpatialComparable o = spatialObjects.get(i);
      byte[] zValue = zValuesList.get(i);
      zValues.put(o, zValue);
    }

    // create a comparator
View Full Code Here


        final SpatialComparator compMin = new SpatialComparator(i, SpatialComparator.MIN);
        Collections.sort(minSorting, compMin);
        final SpatialComparator compMax = new SpatialComparator(i, SpatialComparator.MAX);
        Collections.sort(maxSorting, compMax);

        SpatialComparable mbr_min_left = minSorting.get(0);
        SpatialComparable mbr_min_right = minSorting.get(minSorting.size() - 1);
        SpatialComparable mbr_max_left = maxSorting.get(0);
        SpatialComparable mbr_max_right = maxSorting.get(maxSorting.size() - 1);

        for(int k = 1; k < entries.size() - minEntries; k++) {
          mbr_min_left = SpatialUtil.union(mbr_min_left, minSorting.get(k));
          mbr_min_right = SpatialUtil.union(mbr_min_right, minSorting.get(minSorting.size() - 1 - k));
          mbr_max_left = SpatialUtil.union(mbr_max_left, maxSorting.get(k));
View Full Code Here

        min[d - 1] = entries.get(from).getMin(d);
        max[d - 1] = entries.get(from).getMax(d);
      }

      for(int i = from + 1; i < to; i++) {
        SpatialComparable currMBR = entries.get(i);
        for(int d = 1; d <= min.length; d++) {
          if(min[d - 1] > currMBR.getMin(d)) {
            min[d - 1] = currMBR.getMin(d);
          }
          if(max[d - 1] < currMBR.getMax(d)) {
            max[d - 1] = currMBR.getMax(d);
          }
        }
      }
      return new HyperBoundingBox(min, max);
    }
View Full Code Here

    // Note: we deliberately get a cloned copy here, since we will modify it.
    double[] min = SpatialUtil.getMin(firstEntry);
    double[] max = SpatialUtil.getMax(firstEntry);

    for(int i = 1; i < getNumEntries(); i++) {
      SpatialComparable mbr = getEntry(i);
      for(int d = 1; d <= dim; d++) {
        if(min[d - 1] > mbr.getMin(d)) {
          min[d - 1] = mbr.getMin(d);
        }
        if(max[d - 1] < mbr.getMax(d)) {
          max[d - 1] = mbr.getMax(d);
        }
      }
    }
    return new HyperBoundingBox(min, max);
  }
View Full Code Here

   * @param rtree Rtree to visualize
   * @param entry Current entry
   * @param depth Current depth
   */
  private void visualizeRTreeEntry(SVGPlot svgp, Element layer, Projection2D proj, AbstractRStarTree<? extends N, E> rtree, E entry, int depth) {
    SpatialComparable mbr = entry;

    if(fill) {
      Element r = SVGHyperCube.drawFilled(svgp, INDEX + depth, proj, new Vector(SpatialUtil.getMin(mbr)), new Vector(SpatialUtil.getMax(mbr)));
      layer.appendChild(r);
    }
View Full Code Here

   * @param rtree Rtree to visualize
   * @param entry Current entry
   * @param depth Current depth
   */
  private void visualizeRTreeEntry(SVGPlot svgp, Element layer, Projection2D proj, AbstractRStarTree<? extends N, E> rtree, E entry, int depth) {
    SpatialComparable mbr = entry;

    if(fill) {
      Element r = SVGHyperCube.drawFilled(svgp, INDEX + depth, proj, SpatialUtil.getMin(mbr), SpatialUtil.getMax(mbr));
      layer.appendChild(r);
    }
View Full Code Here

    // Heap of candidates
    TopBoundedHeap<DoubleIntPair> candidates = new TopBoundedHeap<DoubleIntPair>(numCandidates, Collections.reverseOrder());
    for(int i = 0; i < size; i++) {
      // Existing object and extended rectangle:
      SpatialComparable entry = getter.get(options, i);
      HyperBoundingBox mbr = SpatialUtil.union(entry, obj);
      // Area increase
      final double inc_area = SpatialUtil.volume(mbr) - SpatialUtil.volume(entry);
      candidates.add(new DoubleIntPair(inc_area, i));
    }

    // R*-Tree: overlap increase for leaves.
    int best = -1;
    double least_overlap = Double.POSITIVE_INFINITY;
    double least_areainc = Double.POSITIVE_INFINITY;
    double least_area = Double.POSITIVE_INFINITY;
    // least overlap increase, on reduced candidate set:
    while(!candidates.isEmpty()) {
      DoubleIntPair pair = candidates.poll();
      final double inc_area = pair.first;

      // Existing object and extended rectangle:
      SpatialComparable entry = getter.get(options, pair.second);
      HyperBoundingBox mbr = SpatialUtil.union(entry, obj);
      // Compute relative overlap increase.
      double overlap_wout = 0.0;
      double overlap_with = 0.0;
      for(int k = 0; k < size; k++) {
        if(pair.second != k) {
          SpatialComparable other = getter.get(options, k);
          overlap_wout += SpatialUtil.relativeOverlap(entry, other);
          overlap_with += SpatialUtil.relativeOverlap(mbr, other);
        }
      }
      double inc_overlap = overlap_with - overlap_wout;
View Full Code Here

    double least_areainc = Double.POSITIVE_INFINITY;
    double least_area = Double.POSITIVE_INFINITY;
    // least overlap increase, on reduced candidate set:
    for(int i = 0; i < size; i++) {
      // Existing object and extended rectangle:
      SpatialComparable entry = getter.get(options, i);
      HyperBoundingBox mbr = SpatialUtil.union(entry, obj);
      // Compute relative overlap increase.
      double overlap_wout = 0.0;
      double overlap_with = 0.0;
      for(int k = 0; k < size; k++) {
        if(i != k) {
          SpatialComparable other = getter.get(options, k);
          overlap_wout += SpatialUtil.relativeOverlap(entry, other);
          overlap_with += SpatialUtil.relativeOverlap(mbr, other);
        }
      }
      double inc_overlap = overlap_with - overlap_wout;
View Full Code Here

    // As in R-Tree, with a slight modification for ties
    double leastEnlargement = Double.POSITIVE_INFINITY;
    double minArea = -1;
    int best = -1;
    for(int i = 0; i < size; i++) {
      SpatialComparable entry = getter.get(options, i);
      double enlargement = SpatialUtil.enlargement(entry, obj);
      if(enlargement < leastEnlargement) {
        leastEnlargement = enlargement;
        best = i;
        minArea = SpatialUtil.volume(entry);
View Full Code Here

    final int size = getter.size(options);
    assert (size > 0) : "Choose from empty set?";
    double leastEnlargement = Double.POSITIVE_INFINITY;
    int best = -1;
    for(int i = 0; i < size; i++) {
      SpatialComparable entry = getter.get(options, i);
      double enlargement = SpatialUtil.enlargement(entry, obj);
      if(enlargement < leastEnlargement) {
        leastEnlargement = enlargement;
        best = i;
      }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.data.spatial.SpatialComparable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.