Input: the grid to divide
Output: the line storage of grids
Step . If there are not any self or the diameter reaches of grid, don’t divide, add into , and return;
  if not, execute Step ;
Step . Divide each dimension of into two parts, then get sub grids, and map selves of into the sub grids;
Step . For each sub grid, call .
Algorithm 4: The process of .