4  REPRESENTATION AND  
COMPUTATION OF  
LARGE-SCALE TERRAIN 
CHANGES 
In the construction of the QuadTree, the terrain 
height feature can be used in the process of subdi-
viding the hierarchical representation in its different 
levels can be explored (see examples of it in Fig. 1-
3). There, relief heights are captured in different 
levels of detail. In doing so, there is an “inheritance” 
of terrain height values from the father to the child 
nodes, where the child nodes just refine the maxi-
mum and minimum terrain heights represented at the 
father node. A new level in the QuadTree hierarchy 
is built whenever one of these terrain features is 
identified in the analysis of the used real-world GIS-
based maps. This process is repeated until the final 
QuadTree refinement condition is met.  In the end, 
the irregular representation of the terrain is ex-
pressed by QuadTree “leaf” nodes.  
To model the terrain map structure, a directed 
graph is captured as a Tree <n, maxLevel, root>. 
There, a QuadTree node n consists of n <parent, 
children, level, isLeaf, refined> such that n.parent 
and  n.children are pointers used by the hierarchy; 
n.level indicates the level of the hierarchy to which 
the node n belongs to; n.isLeaf indicates whether the 
node is a leaf, and n.refined indicates that new nodes 
were generated from the node n on a temporary 
basis. Tree.maxLevel indicates the maximum hierar-
chical level where the irregular grid is captured by 
the QuadTree leafs. Attributes required for the com-
putation of terrain effects due to river floods and 
wild fires are modeled as n <minHeight, maxHeight, 
neighbors, hasRiver, walkable, flooded, vegeta-
tionDensity, burned>  such that n.minHeight  and 
n.maxHeight capture the minimum and maximum 
terrain height values inside the terrain region repre-
sented by the node n;  n.neighbors consist of a list of 
neighbor nodes of node n, permitting to capture the 
connection between the adjacent nodes; n.hasRiver 
indicates the presence of rivers in the terrain area 
covered by node n; n.walkable indicates whether the 
node  n is navigable by simulated agents; n.flooded 
indicates whether the node n was subjected to terrain 
alterations as a result of the flood fill-based compu-
tations;. n.vegetationDensity indicates the amount of 
trees inside the terrain region represented by the 
node n; and   n.burned indicates whether the node n 
was subjected to the fire alterations. 
The use of the flood fill-based technique along 
with this QuadTree representation occurs as follows. 
An initial node is removed from a control queue. 
Then the flooding test is performed on it. This per-
mits to identify (un)blocked nodes that satisfy a 
“flooding condition”. Such nodes can be blocked for 
the terrestrial agent movement, where the condition 
for it is that (a) the terrain node represents a relief 
height below a certain flood-prone height (i.e. a river 
flood limit) and (b) the node captures a terrain re-
gion that is located next to the course of rivers. In 
doing so, the algorithm considers the maximum and 
minimum terrain relief heights. These are there in 
each QuadTree node as shown in Fig. 2 (this figure 
illustrates some of the steps of the proposed solution 
through an example of a 5m river flood).  
The neighbouring nodes of a flooded one are 
analyzed. When it happens, the flood limit can be a) 
above the maximum terrain height, b) below the 
minimum terrain height, and c) between the maxi-
mum and minimum terrain height. The nodes with 
maximum terrain heights below the flood limit are 
identified and added to the control queue. A node is 
removed from this queue and the algorithm checks 
whether its parent also meets the flooding condition. 
If so, further parent nodes upwards in the hierarchy 
are tested.  
This process continues until a QuadTree node not 
meeting the flooding condition is found. With the 
non-leaf node satisfying the condition, the subtree 
rooted on it is removed from the QuadTree. Then it 
is added to the dictionary. The flooded node is trans-
formed into a leaf one. That ends expressing a larger 
flooded terrain area in the QuadTree. This process 
stops when the control queue is empty. As an exam-
ple, in Fig. 2, the subtree rooted on node 2 is memo-
rized into the dictionary and the QuadTree structure 
is simplified after this process. 
The restoration of the terrain structure consists of 
rebuilding the QuadTree to a targeted state. For 
instance, the reconstruction allows simulating the 
return of the flooded water to the original river bed. 
When analyzing an altered node, the algorithm 
checks whether it was previously refined. For exam-
ple, large terrain areas could have been subdivided 
in smaller pieces, where only a few of these subareas 
were flooded. To do so, the alteration algorithm 
checks the “refined’ attribute represented in the 
QuadTree node. If the node was refined, the restora-
tion procedure carries out the (re)grouping of the 
terrain representation nodes generated due to the 
QuadTree refinement.  
The terrain structure can also be returned to a 
partial representation state, permitting to compute 
the partial flood retreat, for instance. This occurs 
when  the  restoration  condition  allows a portion of