Пример #1
0
 /**
  * shrinks the mbr area to the just necessary
  *
  * @param n
  */
 private void update(RNode n) throws DimensionalException {
   double[] minCoords = new double[dimension];
   double[] maxCoords = new double[dimension];
   for (int i = 0; i < dimension; i++) {
     minCoords[i] = Double.MAX_VALUE;
     maxCoords[i] = -Double.MAX_VALUE;
     for (RNode c : n.children()) {
       c.setParent(n);
       double minp = Math.min(c.getMbr().getP_start()[i], c.getMbr().getP_end()[i]);
       double maxp = Math.max(c.getMbr().getP_end()[i], c.getMbr().getP_start()[i]);
       if (minp < minCoords[i]) {
         minCoords[i] = minp;
       }
       if (maxp > maxCoords[i]) {
         maxCoords[i] = maxp;
       }
     }
   }
   n.setMbr(new MBR(minCoords, maxCoords, dimension));
 }