Research Article

Multiscale Feature Model for Terrain Data Based on Adaptive Spatial Neighborhood

Algorithm 2

The algorithm of generating multi-resolution model of Hilbert space-filling curve.
Input: Cluster .
Output: Space-filling curve (code arrangement of data block) CodeString.
Description: This algorithm generates the space-filling curve
   which contains all data blocks in cluster , by judging
    the type and position of data blocks in cluster .
(1) Initialization:
      (1.1) Define the top layer and bottom layer in cluster  .
      (1.2) Extract the first and the last data block from cluster  .
         According to this, decide the type of data block in layer .
      (1.3) Clear CodeString.
(2) Recall the function DeepTraverse_Cluster ( , , ).
(3) Modify the index file of cluster, and save the new index code
of data blocks in cluster.
(4) The end
DeepTraverse_Cluster (currentBlock, Type, )
Function description: As Hilbert space filling curve,
        generate code of data block in cluster.
Parameter description: currentBlock is the current data block,
        Type is the type of current data block, is
        the layer of current data block.
(1) Get the four data blocks   , and of currentBlock.
(2) Sort   , and   , as the type of Type
    (shown in Figures 4(a)–4(d)).
(3) Judge the data block is whether in cluster :
      (3.1) If is a data block in cluster , then encode
         by the order after sorting, and add it into
         CodeString, where , and 3.
      (3.2) If is not a data block in cluster , then ascertain
         the type of by using rules, and make the recursion
         furthermore, where , and 3.
    (3.2.1) If Type is I, then the types of , , ,
          and are Type III, Type I, Type I, and Type IV.
    (3.2.2) If Type is II, then the types of   ,
          and are Type IV, Type II, Type II, and Type III.
    (3.2.3) If Type is III, then the types of , and
           are Type I, Type III, Type III, and Type II.
    (3.2.4) If Type is IV, then the types of , and
           are Type II, Type IV, Type IV, and Type I.
    (3.2.5) According to the new order, judge data
           blocks on next layer
           For to 4:
         If , then recall
         DeepTraverse_Cluster ( , Type , + 1),
         where Type denotes the new type of data block .
(4) The end of function.