allel rasterization algorithm for vector polygon over-
lay analysis using OpenMP, they discuss in length the
benefits and errors introduced by the discretization of
the vector features, but the implementation is done us-
ing CPU cores. A GPU implementation is discussed
only in the future works. Although the goal of the
paper differs from ours, the solution is interesting to
testify the eligibility of the rasterization approach.
(Ma et al., 2018) proposed a highly efficient tech-
nique for real-time buffer analysis of large-scale spa-
tial data. Their solution uses raster-based buffering
with R-tree queries optimizations and a LOD algo-
rithm to manage rasterization quality. Although they
succeed in providing a visualization oriented paral-
lel model, their buffer generation algorithm does not
benefit from the inherited parallel nature of rasteriza-
tion. In our work, we explore buffer generation with
per-pixel parallelization using acceleration structures
proposed in (Pozzer et al., 2014) and (Engel et al.,
2016).
3 PROPOSED SOLUTION
The proposed solution performs over shapefiles rep-
resenting polylines and polygons. The shapefiles are
primarily loaded and set up in the auxiliary data struc-
tures on the GPU memory (V-RAM), ensuring par-
allelizable optimized spatial queries of the data. In
this process, a spatial hash (Pozzer et al., 2014) is
used to structure the polylines and a quadtree (Engel
et al., 2016) for the polygons. Also, to reduce pro-
cessing and memory cost, the scenario is segmented
into blocks of fixed size in the CPU. Fig. 2 presents a
visual overview of the process discussed below.
The process begins by selecting a block and invok-
ing a Buffering (Sec. 4) process. A texture is used,
in which each pixel covers a specific area within the
block. On the GPU, each pixel is processed indepen-
dently and filled according to its position relative to
the waterbodies, being classified as Inside, Outside or
Border pixel.
The texture generated in the previous step is re-
trieved to the CPU. It goes through a Vectorization
(Sec. 5) process to extract the previously filled pix-
els, where Border pixels form a circular path that is
traversed to generate the final polygons representing
the waterbodies. This process works based on a graph
data structure with a backtracking-like algorithm. Af-
terward, these polygons are then Simplified (Sec. 6)
using a modified version of the Douglas-Peucker al-
gorithm (Douglas and Peucker, 1973), which is a so-
lution to simplify a curve composed of line segments
to a similar curve with fewer points.
The extracted polygons are Triangulated (Sec. 7)
using a constrained Delaunay triangulation algorithm
(Chew, 1989), generating the mesh for a block of the
scenario, which is saved in the disk.
4 TEXTURE GENERATION
A texture represents a discretization of a continuous
block of the scenario, where each pixel represents a
small portion of a block. A pixel size covering a spe-
cific area inside the block and a portion of the scenario
is selected. The texture size is then calculated by:
TextureSize = BlockSize/PixelSize (1)
An extra padding of 1 pixel is added on Eq. (1),
ensuring the correct connection between blocks.
The PixelSize value directly relates to the final
mesh quality and the memory and time resources
spent on the texture generation. If a small pixel size
is used, the final mesh is closer to a geometric so-
lution, resulting in a more accurate representation in
exchange of adding more vertices. Albeit the more
refined result, the memory use increases due to the
large texture needed to cover the block area. A larger
pixel size will result in a coarser mesh, where small
details can be lost due to the pixel covering a large
scenario area, but the time and memory cost will be
much lower. Usually, the chosen PixelSize is kept be-
tween a range of 0.5 and 1 meter, to allow a good ge-
ometric result and to keep the memory cost in a good
range. Larger or smaller PixelSize will lead to a worse
mesh or a higher memory cost, respectively.
Using the information previously set, the genera-
tion consists on taking the distance of every pixel to
the closest river or lake edge, using the acceleration
structures on the GPU. The used accelerated struc-
tures are composed of a linear spatial hash (Pozzer
et al., 2014) for subdividing the terrain and allowing
fast access to the polyline data, and a quadtree struc-
ture (Engel et al., 2016) representing the polygons,
allowing fast point-in-polygon queries. According to
the distance, pixels are classified in three different
types (Fig. 2):
• Outside, pixels outside a river ∧ lake;
• Inside, pixels fully contained in the river ∨ lake;
• Border, pixels as border to a river ⊕ lake.
where ∧ denotes AND operation; ∨ inclusive OR;
and, ⊕ exclusive OR.
Pixels belonging to the texture border, classified
as Inside, are overwritten as Border pixels. This spe-
cial case is necessary to guarantee a correct junction
A Raster-based Approach for Waterbodies Mesh Generation
145