The Gilbert-Johnson-Keerthi (GJK) Algorithm

Slides:



Advertisements
Similar presentations
Collisions using separating-axis tests
Advertisements

Collisions using separating-axis tests Christer Ericson Sony Computer Entertainment
Alpha Shapes. Used for Shape Modelling Creates shapes out of point sets Gives a hierarchy of shapes. Has been used for detecting pockets in proteins.
2.4. Primitive Tests - Closest point
2.5. B ASIC P RIMITIVE I NTERSECTION Details of common forms of primitive intersection test.
1 st Meeting, Industrial Geometry, 2005 Approximating Solids by Balls (in collaboration with subproject: "Applications of Higher Geometrics") Bernhard.
TEL-AVIV UNIVERSITY FACULTY OF EXACT SCIENCES SCHOOL OF MATHEMATICAL SCIENCES An Algorithm for the Computation of the Metric Average of Two Simple Polygons.
Complete Motion Planning
Comments We consider in this topic a large class of related problems that deal with proximity of points in the plane. We will: 1.Define some proximity.
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
OR Simplex method (algebraic interpretation) Add slack variables( 여유변수 ) to each constraint to convert them to equations. (We may refer it as.
Closest Point Transform: The Characteristics/Scan Conversion Algorithm Sean Mauch Caltech April, 2003.
C o m p u t i n g C O N V E X H U L L S by Kok Lim Low 10 Nov 1998 COMP Presentation.
Closest Pair Given a set S = {p1, p2,..., pn} of n points in the plane find the two points of S whose distance is the smallest. Images in this presentation.
1 Convex Hull in Two Dimensions Jyun-Ming Chen Refs: deBerg et al. (Chap. 1) O’Rourke (Chap. 3)
Continuous Collision Detection: Progress and Challenges Gino van den Bergen dtecta
Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin Department of Computer Science University of North Carolina at Chapel.
Advanced Computer Graphics Spring 2014
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
2. Voronoi Diagram 2.1 Definiton Given a finite set S of points in the plane , each point X of  defines a subset S X of S consisting of the points of.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2003 Review Lecture Tuesday, 5/6/03.
UNC Chapel Hill M. C. Lin References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
CS 326 A: Motion Planning robotics.stanford.edu/~latombe/cs326/2004/index.htm Collision Detection and Distance Computation: Feature Tracking Methods.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Continuous Collision Detection David Knott COMP 259 class presentation.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Review Lecture Tuesday, 12/10/02.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
CS 326 A: Motion Planning Collision Detection and Distance Computation.
CS 326A: Motion Planning ai.stanford.edu/~latombe/cs326/2007/index.htm Collision Detection and Distance Computation.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Optimization of Linear Problems: Linear Programming (LP) © 2011 Daniel Kirschen and University of Washington 1.
Robot Motion Planning Computational Geometry Lecture by Stephen A. Ehmann.
LINEAR ALGEBRA A toy manufacturer makes airplanes and boats: It costs $3 to make one airplane and $2 to make one boat. He has a total of $60. The many.
CSE 381 – Advanced Game Programming Quickhull and GJK.
CSE 381 – Advanced Game Programming GJK. GJK Gilbert – Johnson – Keerthi distance algorithm Used to determine the minimum distance between convex sets.
Contact Manifolds Erin Catto Blizzard Entertainment.
Collision handling: detection and response
Simplex method (algebraic interpretation)
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
TEL-AVIV UNIVERSITY RAYMOND AND BEVERLY SACKLER FACULTY OF EXACT SCIENCES SCHOOL OF MATHEMATICAL SCIENCES An Algorithm for the Computation of the Metric.
Intelligent Database Systems Lab 國立雲林科技大學 National Yunlin University of Science and Technology Efficient Optimal Linear Boosting of a Pair of Classifiers.
1 Bounding Iterated Function Systems Orion Sky Lawlor CS 497jch November 14, 2002.
OR Simplex method (algebraic interpretation) Add slack variables( 여유변수 ) to each constraint to convert them to equations. (We may refer it as.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Review Lecture Tuesday, 12/11/01.
OR  Now, we look for other basic feasible solutions which gives better objective values than the current solution. Such solutions can be examined.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
GJK Supplement Reference: SIGGRAPH2004 Course Note Original Reference: A Fast Procedure for Computing the Distance between Objects in Three-Dimensional.
Minkowski Sums and Distance Computation Eric Larsen COMP
Support Vector Machines Reading: Textbook, Chapter 5 Ben-Hur and Weston, A User’s Guide to Support Vector Machines (linked from class web page)
Physics for Games Programmers: Collision Detection Crash Course Gino van den Bergen
Physics for Games Programmers: Continuous Collision Detection Gino van den Bergen Playlogic Game Factory
Physics for Games Programmers: Collision Detection
Computation of the solutions of nonlinear polynomial systems
Algorithm design techniques Dr. M. Gavrilova
References Additional lecture notes for 2/18/02.
Efficient Distance Computation between Non-Convex Objects
Instance Based Learning (Adapted from various sources)
Chapter 4.2 Collision Detection and Resolution
K Nearest Neighbor Classification
Physics for Games Programmers: Crash Course in Collision Detection
2.4. Primitive Tests - Closest point
2.5. Basic Primitive Intersection
Young J. Kim Ming C. Lin Dinesh Manocha
References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics of Surfaces 1998.
Algorithm design (computational geometry)
Computer Animation Algorithms and Techniques
Chapter 2. Simplex method
Presentation transcript:

The Gilbert-Johnson-Keerthi (GJK) Algorithm Christer Ericson Sony Computer Entertainment America christer_ericson@playstation.sony.com

Talk outline What is the GJK algorithm Terminology “Simplified” version of the algorithm One object is a point at the origin Example illustrating algorithm The distance subalgorithm GJK for two objects One no longer necessarily a point at the origin GJK for moving objects

GJK solves proximity queries Given two convex polyhedra Computes distance d Can also return closest pair of points PA, PB

GJK solves proximity queries Generalized for arbitrary convex objects As long as they can be described in terms of a support mapping function

Terminology 1(3) Supporting (or extreme) point for direction Supporting points are not necessarily unique. That is, there may be infinitely many supporting points for a given direction. The support mapping function for a convex polyhedron simply returns the vertex most distant in direction d (any one if several equally distant). The support mapping for a sphere C of radius r and center O is given by SC(d) = O + r * ||d||. Supporting (or extreme) point for direction returned by support mapping function

Terminology 2(3) 0-simplex 1-simplex 2-simplex 3-simplex simplex A d-simplex is the convex hull of d+1 affinely independent points in d-dimensional space. A simplex (plural simplices) is a d-simplex, for some given d. simplex

Terminology 3(3) Point set C Convex hull, CH(C) The convex hull of a set C of points is here denoted by CH(C).

The GJK algorithm Initialize the simplex set Q with up to d+1 points from C (in d dimensions) Compute point P of minimum norm in CH(Q) If P is the origin, exit; return 0 Reduce Q to the smallest subset Q’ of Q, such that P in CH(Q’) Let V=SC(–P) be a supporting point in direction –P If V no more extreme in direction –P than P itself, exit; return ||P|| Add V to Q. Go to step 2 “Point of minimum norm” is a snooty way of saying “point closest to the origin”.

GJK example 1(10) INPUT: Convex polyhedron C given as the convex hull of a set of points The example here uses a convex polyhedron, but the same principle applies to any convex object.

GJK example 2(10) Initialize the simplex set Q with up to d+1 points from C (in d dimensions) Here we initialize Q with three points simply to reduce the number of steps required for the algorithm to terminate (to keep the example short).

GJK example 3(10) Compute point P of minimum norm in CH(Q) Exactly how the point of minimum norm in CH(Q) is found is described further ahead.

GJK example 4(10) If P is the origin, exit; return 0 Reduce Q to the smallest subset Q’ of Q, such that P in CH(Q’) Only Q1 and Q2 are needed to express P as a convex combination of points in Q. Q0 is therefore deleted from Q. A convex combination is a weighted linear combination of the points, all weights being non-negative. (Compare barycentric coordinates.)

GJK example 5(10) Let V=SC(–P) be a supporting point in direction –P The indicated yellow point V is the supporting point in direction –P.

GJK example 6(10) If V no more extreme in direction –P than P itself, exit; return ||P|| Add V to Q. Go to step 2

GJK example 7(10) Compute point P of minimum norm in CH(Q)

GJK example 8(10) If P is the origin, exit; return 0 Reduce Q to the smallest subset Q’ of Q, such that P in CH(Q’)

GJK example 9(10) Let V=SC(–P) be a supporting point in direction –P Here there are infinitely many supporting points in direction –P. We arbitrarily picked Q2.

GJK example 10(10) If V no more extreme in direction –P than P itself, exit; return ||P|| DONE! Q2 is no more extreme than P in direction –P, so the algorithm terminates. P is the point on C closest to the origin.

Distance subalgorithm 1(2) Approach #1: Solve algebraically Used in original GJK paper Johnson’s distance subalgorithm Searches all simplex subsets Solves system of linear equations for each subset Recursive formulation From era when math operations were expensive Robustness problems See e.g. Gino van den Bergen’s book

Distance subalgorithm 2(2) Approach #2: Solve geometrically Mathematically equivalent But more intuitive Therefore easier to make robust Use straightforward primitives: ClosestPointOnEdgeToPoint() ClosestPointOnTriangleToPoint() ClosestPointOnTetrahedronToPoint() Second function outlined here The approach generalizes

Closest point on triangle ClosestPointOnTriangleToPoint() Finds point on triangle closest to a given point

Closest point on triangle Separate cases based on which feature Voronoi region point lies in A triangle has 7 feature Vornoi regions: 3 vertex regions, 3 edge regions, and 1 face region.

Closest point on triangle If the point lies in a vertex region, the closest point on the triangle is that vertex. The vertex regions are all tested in a similar manner.

Closest point on triangle If the point lies in an edge region, the closest point on the triangle is the orthogonal projection of the point onto the edge. If neither vertex nor edge regions contain the point, the closest point must lie inside the triangle (in the face region).

GJK for two objects What about two polyhedra, A and B? Reduce problem into the one solved No change to the algorithm! Relies on the properties of the Minkowski difference of A and B Not enough time to go into full detail Just a brief description

Minkowski sum & difference The sweeping of one convex object with another Defined as:

Minkowski sum & difference Minkowski difference, defined as: Can write distance between two objects as: A and B intersecting iff A–B contains the origin! Distance between A and B given by point of minimum norm in A–B!

The generalization A and B intersecting iff A–B contains the origin! Distance between A and B given by point of minimum norm in A–B! So use previous procedure on A–B! Only change needed: computing Support mapping separable, so can form it by computing support mapping for A and B separately!

GJK for moving objects With minimal changes GJK can be applied to detect collisions between objects undergoing uniform linear (translational) motion.

Transform the problem… The first step is to transform the problem from two moving objects into a problem of one moving and one stationary object.This transformation is done by subtracting VB off the movement of both objects, rendering object B stationary.

…into moving vs stationary

Alt #1: Point duplication Let object A additionally include the points To see if A during its motion intersects with B we form the swept volume of A and intersect it against B. One approach to forming the swept volume is to include the points Pi+v in A (in addition to its original points Pi). A drawback with this approach is that doubling the points of A creates more work in finding supporting points. …effectively forming the convex hull of the swept volume of A

Alt #2: Support mapping Modify support mapping to consider only points when A better approach is to modify the support mapping function to search for a supporting point amongst either Pi or Pi+v depending on the sign of Dot(d, v).

Alt #2: Support mapping …and to consider only points when

GJK for moving objects Presented solution Gives only Boolean interference detection result Interval halving over v gives time of collision Using simplices from previous iteration to start next iteration speeds up processing drastically Overall, always starting with the simplices from the previous iteration makes GJK… Incremental Very fast The described solution only gives a Boolean interference detection result. That is, it only specifies if the objects intersect during motion, not where. Determining the time of collision can be done by applying an interval halving approach to the motion vector v. This is fast, since the simplices from the previous iteration are an excellent starting point for the next iteration.

References Ericson, Christer. Real-time collision detection. Morgan Kaufmann, 2005. http://www.realtimecollisiondetection.net/ van den Bergen, Gino. Collision detection in interactive 3D environments. Morgan Kaufmann, 2003. Gilbert, Elmer. Daniel Johnson, S. Sathiya Keerthi. “A fast procedure for computing the distance between complex objects in three dimensional space.” IEEE Journal of Robotics and Automation, vol.4, no. 2, pp. 193-203, 1988. Gilbert, Elmer. Chek-Peng Foo. “Computing the Distance Between General Convex Objects in Three-Dimensional Space.” Proceedings IEEE International Conference on Robotics and Automation, pp. 53-61, 1990. Xavier Patrick. “Fast swept-volume distance for robust collision detection.” Proc of the 1997 IEEE International Conference on Robotics and Automation, April 1997, Albuquerque, New Mexico, USA. Ruspini, Diego. gilbert.c, a C version of the original Fortran implementation of the GJK algorithm. ftp://labrea.stanford.edu/cs/robotics/sean/distance/gilbert.c