Computer-Aided Design 87 (2017) 20–28
Contents lists available at ScienceDirect
Computer-Aided Design
journal homepage: www.elsevier.com/locate/cad
Fast and robust GPU-based point-in-polyhedron determination
Jing Li
a,b,
*, Wencheng Wang
b,c
a
State Key Laboratory of Integrated Information System Technology, Institute of Software, Chinese Academy of Sciences, Beijing 100190, China
b
State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences, Beijing 100190, China
c
The University of Chinese Academy of Sciences, Beijing 100049, China
a r t i c l e i n f o
Article history:
Received 12 August 2015
Accepted 12 February 2017
Keywords:
Point-in-polyhedron test
GPU
3D uniform grids
Ray-crossing
a b s t r a c t
This paper presents a fast and robust GPU-based point-in-polyhedron determination method. The method
partitions the bounding box of the polyhedron into a grid with O(N) cells, where N is the number of
polyhedron faces, and predetermines the inclusion property of the grid cells’ center points. Then, a line
segment is generated from the query point to the center point of its related grid cell to determine the
inclusion property of the query point by counting the faces intersected by the line segment. Such a
localization treatment is further exploited to optimize the visiting pattern in using GPUs, by which a high
increase in the testing speed is achieved. We also provide a unified solution to all singular cases, especially
those caused by localization, to guarantee the efficiency and robustness for point-in-polyhedron tests.
The results show that our proposed method can be faster than both state-of-the-art serial and parallel
methods by several orders of magnitude, with only a slight increase in storage requirement.
© 2017 Elsevier Ltd. All rights reserved.
1. Introduction
Point-in-polyhedron determination is a fundamental problem
in computational geometry. It is widely used in many fields like
computer-aided design (CAD), computer graphics, and geographic
information systems (GIS) to support animation, realistic render-
ing, collision detection, and point location in 3D GIS. Obviously,
its efficient implementation is important to high-level algorithms.
Currently, in various applications, the amount of query points is
rapidly increasing, and an increasingly higher processing speed is
required, with demands to be met even in real time, and the models
may change their shapes frequently. For example, more and more
points are needed to produce more realistic effects in games, and
the amount of mobile equipment with location and navigation
sensors is rapidly increasing. Thus, this brings a huge challenge to
fast execute point-in-polyhedron determination. In this paper, we
present a method to execute these inclusion tests using GPUs, in
an attempt to address this challenge.
To our knowledge, GPUs have been extensively applied to ac-
celerate various basic geometrical algorithms. Unfortunately, only
few research studies are known to apply GPUs to the point-in-
polyhedron test. Normally, ray-crossing can be easily implemented
on a GPU by assigning a thread to each query point for its deter-
mination in parallel. However, the time complexity for a query
*
Corresponding author at: State Key Laboratory of Integrated Information
System Technology, Institute of Software, Chinese Academy of Sciences, Beijing
100190, China.
E-mail addresses: lijing2015@iscas.ac.cn, superredlark@163.com (J. Li).
is still O(N), where N is the number of polyhedron faces. When
the number of points is far greater than the number of processing
units of a GPU, the running time is still very high. Though there
are methods with lower time complexities (e.g., O(log N)), they
are typically based on a structure including hierarchical trees to
decrease the time complexity, which are generally inconvenient to
implement on a GPU.
In our method, we attempt to confine the point-in-polyhedron
determination within a local region, and locally apply the ray-
crossing method. This is by constructing a uniform grid with O(N)
grid cells according to the bounding box of the polyhedron, and
predetermining the inclusion property of the cells’ center points
as priors for point-in-polyhedron determination, which means
to determine the cells’ center points as inside or outside of the
polyhedron before answering query points. Thus, for a query point,
we only need to process the faces in the grid cell containing the
query point, to count the faces that intersect with the line from the
query point to the center point of the cell, by which ray-crossing is
applied locally, which is discussed in detail in Section 3. Thus, we
can reduce the time complexity by avoiding multiple ray-face tests
and conveniently use the GPU for point-in-polyhedron determi-
nation. Furthermore, we develop novel measures to considerably
reduce the time for constructing auxiliary structures and thereby
speed up point-in-polyhedron determination. Thus, we can well
treat the applications that use a large number of points and exhibit
dynamic changes in polyhedron geometry. Experimental results
show that our method needs only 8 ms to determine 1M points
against a gear box model with 165K faces from [1], whereas the
http://dx.doi.org/10.1016/j.cad.2017.02.001
0010-4485/© 2017 Elsevier Ltd. All rights reserved.