procedure DispatchEvent (ght, e)
hmap := IdentifyHmap (ght, e)
newheightmaps := CreateHeightmaps (hmap, e)
ApplyEvent (hmap, e, newheightmaps)
AttachNewHeightmaps (hmap, newheightmaps)
endprocedure
Figure 6: Editing the GHT.
Procedure
ApplyEvent()
considers two families of
events: geotectonic and carvings. Geotectonic events
include linear and radial erosion and, normal, inverse
and lateral faults. Carvings include tunnels and caves.
Each basic operation is defined by a set of parameters
and the effect on the terrain will depend on the spe-
cific values assigned to them when the operation is
triggered. Next we detail how each family of events
is applied.
Figure 7 illustrates the geometry generated by the
geotectonic events we consider. Linear erosion needs
four grounded heightmaps and is defined by two
points and an scalar. Points fix the position and length
of the erosion, the scalar fixes the erosion depth. Ra-
dial erosion needs one grounded heightmap and is de-
fined as an ellipsoid given by the radii and center. Pa-
rameters in faults are defined by two points that define
position and length, plus an scalar that fixes the terrain
surface area affected by the event. Normal and in-
verse faults need three grounded heightmaps and lat-
eral faults need two grounded heightmaps.
The algorithm in Figure 8 describes how geo-
tectonic events are dealt with. First for each new
heightmap in the event, the boundaries of the af-
fected local terrain region are projected onto the XZ
plane. Then for each cell in the 2D array of the new
heightmap within the projected boundaries of the af-
fected region, we apply the following process. If the
current new heightmap and
hmap
have the same orien-
tation and the
hmap
cell is a height, the newheightmap
cell value is the height in
hmap
. If the
hmap
cell is a
link, the newheightmap cell is a link to the considered
hmap
cell.
When the new heightmap and
hmap
have different
orientations the situation is a little bit more complex.
We have to assign to the cells in the new heightmap
values taken from
hmap
. Since the ground plane
of the new heightmap is at an angle with the
hmap
ground plane, in general, the 2D cell array of the new
heightmap has more cells than that of
hmap
. Height
values for the extra cells in the new heightmap are
computed applying a simple linear interpolation.
After defining a new heightmap, those cells in
hmap
whose values have been transferred to the new
heightmap no longer represent a valid height. There-
fore the links in
hmap
point to the corresponding cells
procedure GeotectonicEvent (hmap, e, newheightmaps)
for hm in newheightmaps do
bound := ComputeBoundary (hm, e)
if SameOrientation(hmap, hm) then
FillData(hmap, hm, e, bound)
else
FillInterpolatedData(hmap, hm, e, bound)
endif
UpdateHmap(hmap, hm)
PreserveGHTContinuity(hmap, hm, e, bound)
endfor
endprocedure
Figure 8: Geotectonic event algorithm.
in the new heightmap. Finally to preserve GHT con-
tinuity each cell in the boundary of a new heightmap
is linked to the neighbor cell in another heightmap.
Carving events are defined in two steps. First a
protovolume is defined by sweeping a cross section
along a rectilinear axis. Then the carving is gener-
ated by subtracting the protovolume from the terrain
model.
The protovolume is characterized by two points,
a polygonal cross section, and two scalars. The two
points define both the axis and span of the protovol-
ume. The polygonal cross section defines the carv-
ing cross shape. Each scalar is used to scale respec-
tively the cross section to its actual size at the begin-
ning and at the end of the protovolume. The num-
ber of grounded heightmaps in a carving tunnel is the
number of sides in the polygonal cross section plus
two heightmaps that define the indoor-outdoor bor-
ders. The ground planes of these heightmaps are co-
incident with the XZ plane. In the carving cave, we
have one heightmap that defines the cave entry and
another one that defines the cave end. Carving events
can be applied only on the GHT root node since so
far we only support them on the XZ plane. Figure 9
left illustrates the shape generated by tunnel carving.
Figure 9 right depicts the shape generated by carving
a cave.
The carving process algorithm its outlined in Fig-
ure 10. First the algorithm extracts from the event
Figure 9: Carving events.
THE GROUNDED HEIGHTMAP TREE - A New Data Structure for Terrain Representation
83