Detecting the intersection of two convex shapes by searching on the 2-sphere☆
Graphical abstract
Introduction
This paper is concerned with the problem of detecting the intersection of two convex objects. Given two convex objects and in , we ask whether and have a point in common or not. When that is the case we say that “they intersect” or “they touch each other”. The intersection detection problem is a component of collision detection for more general shapes, which plays a major role in robotics [1], computer animation [2] and mechanical simulation for example.
Intersection detection also plays a role in computer graphics in general as an ingredient in acceleration data structures, such as bounding volume hierarchies or Kd-trees. In the latter case, an object of interest (e.g. a ray, a view frustum, or another hierarchy) is tested for intersection against the geometric shapes that bound each node in the hierarchy. These bounding shapes are simple shapes (boxes, spheres) for which fast intersection detection techniques exist. For an in-depth exposition to intersection and collision detection, we refer the reader to the book of Ericson [3] and the survey of Jiménez et al. [4].
In robotics or computer graphics, we often limit ourselves to constant-size or small convex objects, and techniques that do not use pre-processing, but the intersection detection problem has several variants and has been studied by theoreticians as well. Computational geometers have recently developed an optimal solution for general convex polyhedra: Given any collection of convex polyhedra in, one can pre-process them in linear time, independently of each other, so that the intersection of any two polyhedra and from the collection can be tested in optimal time (see [5] and the other references within). This essentially closes the (theoretical) problem for the case of convex polyhedra. It is not clear if their technique is amenable to an efficient implementation since the data-structures used are not simple and it requires knowledge of the connectivity between the polyhedron neighboring facets.
In this paper however, we only consider techniques that do not use excessive or complex pre-processing 1and are asymptotically slower, but very fast in practice.
Of particular interest is the beautiful algorithm developed by Gilbert, Johnson and Keerthi (GJK) for computing the distance between two convex polyhedra and [6]. It only needs access to the vertices of the polyhedra and typically uses just a few iterations over them to compute the distance. It was later generalized and adapted to the decision version of the problem by Gilbert and Foo [1] to handle a broader class of convex objects. We describe these algorithms in Section 3.
In this paper we view the decision problem as that of finding an oriented plane that sets on its negative and on its positive side. Writing for the set of normals to the planes achieving separation, we design, in Section 4, an algorithm to find a direction in or decide that is empty (when and do touch each other). Our algorithm iteratively prunes parts of the unit sphere so that the remaining part, a convex spherical polygon, provides an increasingly tight superset of. We call it Decision Sphere Search, or DSS for short.
Section 5 gives a theoretical analysis of DSS and an extensive comparison of DSS with GJK. In particular, we show that DSS optimally aggregates the information gathered about the Minkowski difference during the successive iterations.
In Section 6, we benchmark our implementations of a “naive”, quadratic algorithm, of DSS and of GJK. Each benchmark considers a specific type of objects and measures the performance of the algorithm with respect to the “collision density”, i.e. the ratio of the number of tested pairs of convex objects that actually intersect to the total number of tested pairs. Our DSS technique appears to be faster than GJK in general, numerically more robust and easier to implement. We have taken care to analyze a large variety of situations including very uneven ones, such as frustum-culling where one object (the frustum) is much larger than the other. In that case, we show that a hybrid technique combining DSS and GJK gives the overall best results and we explain why.
Section snippets
Preliminaries
It is simpler to work with an alternative view of the geometry of the intersection detection problem, thereby reducing it to deciding whether a closed convex set contains the origin or not. The rest of the present section describes this well known alternative view.
The Minkowski sum and Minkowski difference of two subsets and of are (see Fig. 1): Using this definition, and have non-empty intersection if and only if contains the origin:
Related work
Research on practical intersection detection techniques for static convex shapes has not been very active in recent years, so we can refer the reader to the survey of Jiménez et al. [4] and the excellent book of Ericson [3]. We also refer the reader to our technical report [9], where we propose a review of previous work on intersection detection problem for small convex polyhedra with or without specific symmetries, through the unifying lens of Minkowski sums and the Gauss map, which both play
Our decision sphere search algorithm
Our algorithm is similar in spirit to the GJK/GF algorithm: We sequentially generate candidate directions along which the convex and the origin are tested for separation using equations (11) and (8) until a final decision can be taken. Our algorithm differs from theirs in the way a new test direction is generated (they search a point closest to the origin on a simplex inside, whereas we pick a point in a convex spherical polygon) and in that we do not seek the actual distance between the two
A characterization of the separating planes
This section derives a characterization of the planes separating two convex objects that we use in Section 5.2 to understand the differences between our algorithm and GJK. This characterization, embodied in definition (12) and Lemma 2 .
First, recall that testing that and touch each other is equivalent to testing that the origin lies in the Minkowski difference. In this section, in order to simplify the exposition, we therefore consider the geometrically (but not computationally)
Benchmarks
We have compared our implementations of DSS, GJK and other algorithms, over a few kinds of randomly generated data sets: random pairs of tetrahedra, oriented boxes and polytopes, and frustum culling of random spheres and axis-aligned boxes.
In the figures below, Generic is an implementation of a “naive” technique 4that we described
Concluding remarks
We have developed a new algorithm, DSS, to decide the disjointness of two convex shapes, by searching on the 2-sphere. Just as for GJK, DSS simply assumes that the extremal function (page 72) is computable on the shapes at hand. Compared to GJK, DSS is (i) easier to implement, (ii) numerically more robust, (iii) typically a little bit faster and never much slower.
We have however considered only the disjointness decision problem. But GJK can compute the actual distance between the two shapes.
Acknowledgment
This work was partially supported by ERC grant ShapeForge (StG-2012-307877).
References (23)
- et al.
3D Collision Detection: A Survey
Comput Graph
(2001) - et al.
Determining the directional contact range of two convex polyhedra
Comput Aided Des
(2010) - et al.
A hierarchical method for real-time distance computation among moving convex bodies
Comput Geom Theory Appl
(2000) - et al.
A generic lazy evaluation scheme for exact geometric computations
Sci Comput Program
(2011) Detecting intersection of a rectangular solid and a convex polyhedron
- et al.
Computing the distance between general convex objects in three-dimensional space
IEEE J Robot Autom
(1990) - et al.
OBBTree: A Hierarchical Structure for Rapid Interference Detection
Real-Time collision detection
(2004)- et al.
Optimal detection of intersections between convex polyhedra
- et al.
A fast procedure for computing the distance between complex objects in three-dimensional space
IEEE J Robot Autom
(1988)
Surfaces closed under five important geometric operations
Cited by (4)
Polynomial-time parametric optimisation
2023, arXivCertifying the Intersection of Reach Sets of Integrator Agents With Set-Valued Input Uncertainties
2022, IEEE Control Systems Letters
- ☆
This paper has been recommended for acceptance by Dr. Mario Botsch, Dr. Yongjie Jessica Zhang and Dr. Stefanie Hahmann.