コード例 #1
0
    public void run() {
      for (int g = start; g <= end; ++g) {
        root[g] = new TreeNode(points.length);

        for (int i = 0; i < points.length; ++i) {
          double r = Rp / 2;
          double[] center = createPoint(dimensions, r);

          TreeNode currentTreeNode = root[g];
          for (int j = 0; j < levels; ++j) {
            int index = cellFinder(points[i], center, grids[g], r / 2);
            currentTreeNode = currentTreeNode.createChild(index);
            r /= 2;
          }
        }
      }
    }
コード例 #2
0
  /*
   * create Quad-trees with no parallelization
   */
  private void createQuadTree() {
    root = new TreeNode[grids.length];
    for (int g = 0; g < grids.length; ++g) {
      root[g] = new TreeNode(points.length);
      for (int i = 0; i < points.length; ++i) {
        double r = Rp / 2;
        double[] center = createPoint(dimensions, r);

        TreeNode currentTreeNode = root[g];
        for (int j = 0; j < levels; ++j) {
          int index = cellFinder(points[i], center, grids[g], r / 2);
          currentTreeNode = currentTreeNode.createChild(index);
          r /= 2;
        }
      }
    }
  }