![Page 1: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/1.jpg)
TheGilbert-Johnson-Keerthi (GJK)
Algorithm
TheTheGilbertGilbert--JohnsonJohnson--KeerthiKeerthi (GJK)(GJK)
AlgorithmAlgorithm
Christer EricsonSony Computer Entertainment America
ChristerChrister EricsonEricsonSony Computer Entertainment AmericaSony Computer Entertainment America
[email protected][email protected]
Christer Ericson
Talk outlineTalk outlineTalk 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
![Page 2: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/2.jpg)
Christer Ericson
GJK solves proximity queriesGJK solves proximity queriesGJK solves proximity queries
dAP
BP
• Given two convex polyhedra– Computes distance d– Can also return closest pair of points PA, PB
Christer Ericson
GJK solves proximity queriesGJK solves proximity queriesGJK solves proximity queries
dAP
BP
• Generalized for arbitrary convex objects– As long as they can be described in terms of
a support mapping function
![Page 3: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/3.jpg)
Christer Ericson
Terminology 1(3)Terminology 1(3)Terminology 1(3)
Supporting (or extreme) point
d
( )CP S= d
P dfor direction
C
( )CS dreturned by support mapping function
( )CP S= d
C
Christer Ericson
Terminology 2(3)Terminology 2(3)Terminology 2(3)
0-simplex 1-simplex 2-simplex 3-simplex
simplex
![Page 4: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/4.jpg)
Christer Ericson
Terminology 3(3)Terminology 3(3)Terminology 3(3)
Point set C Convex hull, CH(C)
Christer Ericson
The GJK algorithmThe GJK algorithmThe GJK algorithm
1. Initialize the simplex set Q with up to d+1 points from C (in d dimensions)
2. Compute point P of minimum norm in CH(Q)3. If P is the origin, exit; return 04. Reduce Q to the smallest subset Q’ of Q, such
that P in CH(Q’)5. Let V=SC(–P) be a supporting point in direction
–P6. If V no more extreme in direction –P than P
itself, exit; return ||P||7. Add V to Q. Go to step 2
![Page 5: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/5.jpg)
Christer Ericson
GJK example 1(10)GJK example 1(10)GJK example 1(10)
C
INPUT: Convex polyhedron C given as the convex hull of a set of points
Christer Ericson
1. Initialize the simplex set Q with up to d+1 points from C (in ddimensions)
GJK example 2(10)GJK example 2(10)GJK example 2(10)
0Q
{ }0 1 2, ,Q QQ Q=
C1Q
2Q
![Page 6: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/6.jpg)
Christer Ericson
GJK example 3(10)GJK example 3(10)GJK example 3(10)
{ }0 1 2, ,Q Q Q Q=
1Q
0Q
2Q
P
2. Compute point P of minimum norm in CH(Q)
Christer Ericson
GJK example 4(10)GJK example 4(10)GJK example 4(10)
{ }1 2,Q Q Q=
1Q
0QP
3. If P is the origin, exit; return 04. Reduce Q to the smallest subset Q’ of Q, such that P in CH(Q’)
2Q
![Page 7: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/7.jpg)
Christer Ericson
GJK example 5(10)GJK example 5(10)GJK example 5(10)
{ }1 2,Q Q Q=
1Q
2Q
P
5. Let V=SC(–P) be a supporting point in direction –P
( )CV S P= −
Christer Ericson
GJK example 6(10)GJK example 6(10)GJK example 6(10)
1Q
{ }1 2, ,Q Q Q V=
2QV
6. If V no more extreme in direction –P than P itself, exit; return ||P||7. Add V to Q. Go to step 2
![Page 8: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/8.jpg)
Christer Ericson
GJK example 7(10)GJK example 7(10)GJK example 7(10)
{ }1 2, ,Q Q Q V=
1Q
2QV P
2. Compute point P of minimum norm in CH(Q)
Christer Ericson
GJK example 8(10)GJK example 8(10)GJK example 8(10)
{ }2,Q Q V=
2QV P
3. If P is the origin, exit; return 04. Reduce Q to the smallest subset Q’ of Q, such that P in CH(Q’)
![Page 9: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/9.jpg)
Christer Ericson
GJK example 9(10)GJK example 9(10)GJK example 9(10)
2' ( )CS QV P= − =
{ }2,Q Q V=
V P
5. Let V=SC(–P) be a supporting point in direction –P
Christer Ericson
GJK example 10(10)GJK example 10(10)GJK example 10(10)
V P
DONE!DONE!{ }2,Q Q V=
6. If V no more extreme in direction –P than P itself, exit; return ||P||
2Q
![Page 10: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/10.jpg)
Christer Ericson
Distance subalgorithm 1(2)Distance Distance subalgorithmsubalgorithm 1(2)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
Christer Ericson
Distance subalgorithm 2(2)Distance Distance subalgorithmsubalgorithm 2(2)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
![Page 11: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/11.jpg)
Christer Ericson
Closest point on triangleClosest point on triangleClosest point on triangle
B C
A
• ClosestPointOnTriangleToPoint()– Finds point on triangle closest to a given point
P
Q
Christer Ericson
Closest point on triangleClosest point on triangleClosest point on triangle
B C
A
F
AV
BV CV
ABEACE
BCE
• Separate cases based on which feature Voronoiregion point lies in
![Page 12: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/12.jpg)
Christer Ericson
Closest point on triangleClosest point on triangleClosest point on triangle
A
B C
00
AX ABAX AC
⋅ ≤⋅ ≤
XAV
Christer Ericson
Closest point on triangleClosest point on triangleClosest point on triangle
B C
( ) 000
BC BA BA BXAX ABBX BA
× × ⋅ ≥⋅ ≥⋅ ≥X A
ABE
![Page 13: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/13.jpg)
Christer Ericson
GJK for two objectsGJK for two objectsGJK 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
Christer Ericson
Minkowski sum & differenceMinkowskiMinkowski sum & differencesum & difference
{ }: ,A B A B+ = + ∈ ∈a b a b
BA A B+
• Minkowski sum– The sweeping of one convex object with another
• Defined as:–
![Page 14: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/14.jpg)
Christer Ericson
Minkowski sum & differenceMinkowskiMinkowski sum & differencesum & difference
{ }{ }
distance( , ) min : ,
min :
A B A B
A B
= − ∈ ∈
= ∈ −
a b a b
c c
{ }: ,
( )
A B A BA B
− = − ∈ ∈
= + −
a b a b• 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!
Christer Ericson
The generalizationThe generalizationThe generalization
( ) ( ) ( ) ( )C A B A BS S S S−= = − −d d d d
• 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 Bseparately!–
( ) ( )C A BS S −=d d
![Page 15: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/15.jpg)
Christer Ericson
Av
Bv
GJK for moving objectsGJK for moving objectsGJK for moving objects
Christer Ericson
Av
Bv
B−v A B= −v v v
Transform the problem…Transform the problem…Transform the problem…
![Page 16: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/16.jpg)
Christer Ericson
v
…into moving vs stationary……into moving into moving vsvs stationarystationary
Christer Ericson
Alt #1: Point duplicationAlt #1: Point duplicationAlt #1: Point duplication
Let object A additionally include the points
iP
iP + vv
iP + v
…effectively forming the convex hull of the swept volume of A
![Page 17: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/17.jpg)
Christer Ericson
Alt #2: Support mappingAlt #2: Support mappingAlt #2: Support mapping
iP
Modify support mapping to consider only points
wheniP0⋅ ≤d v
d
v
Christer Ericson
Alt #2: Support mappingAlt #2: Support mappingAlt #2: Support mapping
iP + v
…and to consider only points wheniP + v 0⋅ >d v
d
v
![Page 18: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/18.jpg)
Christer Ericson
GJK for moving objectsGJK for moving objectsGJK 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
Christer Ericson
ReferencesReferencesReferences• Ericson, Christer. Real-time collision detection. Morgan Kaufmann,
forthcoming. http://www.realtimecollisiondetection.com/• 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
![Page 19: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/19.jpg)
Collision DetectionThe GJK Algorithm
Knud Henriksen
Department of Computer Science
University of Copenhagen
c© Knud Henriksen – p.1/11
![Page 20: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/20.jpg)
Affine and Convex Hulls
c© Knud Henriksen – p.2/11
![Page 21: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/21.jpg)
Affine and Convex Hulls
Given a finite set of points X = {x1, . . . ,xn}
The Affine Hull of X is given by
aff (X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1
}
The Convex Hull of X is given by
conv(X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1 ∧ λi ≥ 0
}
c© Knud Henriksen – p.3/11
![Page 22: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/22.jpg)
Affine and Convex Hulls
Given a finite set of points X = {x1, . . . ,xn}The Affine Hull of X is given by
aff (X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1
}
The Convex Hull of X is given by
conv(X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1 ∧ λi ≥ 0
}
c© Knud Henriksen – p.3/11
![Page 23: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/23.jpg)
Affine and Convex Hulls
Given a finite set of points X = {x1, . . . ,xn}The Affine Hull of X is given by
aff (X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1
}
The Convex Hull of X is given by
conv(X) =
{ n∑
i=1
λixi
∣
∣
∣
∣
n∑
i=1
λi = 1 ∧ λi ≥ 0
}
c© Knud Henriksen – p.3/11
![Page 24: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/24.jpg)
The Distance Between Objects
Given two objects A,B ⊂ Rn
The distance, d : Rn × R
n −→ R,between A and B is defined to be
d(A,B) = min{
||x − y|| | x ∈ A ∧ y ∈ B}
A B
d(A, B)
c© Knud Henriksen – p.4/11
![Page 25: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/25.jpg)
The Distance Between Objects
Given two objects A,B ⊂ Rn
The distance, d : Rn × R
n −→ R,between A and B is defined to be
d(A,B) = min{
||x − y|| | x ∈ A ∧ y ∈ B}
A B
d(A, B)
c© Knud Henriksen – p.4/11
![Page 26: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/26.jpg)
The Distance Between Objects
Given two objects A,B ⊂ Rn
The distance, d : Rn × R
n −→ R,between A and B is defined to be
d(A,B) = min{
||x − y|| | x ∈ A ∧ y ∈ B}
A B
d(A, B)
c© Knud Henriksen – p.4/11
![Page 27: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/27.jpg)
The Distance Between Objects
Given two objects A,B ⊂ Rn
The distance, d : Rn × R
n −→ R,between A and B is defined to be
d(A,B) = min{
||x − y|| | x ∈ A ∧ y ∈ B}
A B
A B
d(A, B)
c© Knud Henriksen – p.4/11
![Page 28: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/28.jpg)
The Distance Between Objects
Given two objects A,B ⊂ Rn
The distance, d : Rn × R
n −→ R,between A and B is defined to be
d(A,B) = min{
||x − y|| | x ∈ A ∧ y ∈ B}
A B
d(A, B)
c© Knud Henriksen – p.4/11
![Page 29: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/29.jpg)
Minkowski Difference
Given two objects A,B ⊂ Rn
The Minkowski Difference is defined as the setA − B ⊂ R
n , where
A − B ={
a − b | a ∈ A ∧ b ∈ B}
If the sets A and B are convex then the Minkowski
Difference is also convex.
c© Knud Henriksen – p.5/11
![Page 30: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/30.jpg)
Minkowski Difference
Given two objects A,B ⊂ Rn
The Minkowski Difference is defined as the setA − B ⊂ R
n
, where
A − B ={
a − b | a ∈ A ∧ b ∈ B}
If the sets A and B are convex then the Minkowski
Difference is also convex.
c© Knud Henriksen – p.5/11
![Page 31: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/31.jpg)
Minkowski Difference
Given two objects A,B ⊂ Rn
The Minkowski Difference is defined as the setA − B ⊂ R
n , where
A − B ={
a − b | a ∈ A ∧ b ∈ B}
If the sets A and B are convex then the Minkowski
Difference is also convex.
c© Knud Henriksen – p.5/11
![Page 32: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/32.jpg)
Minkowski Difference
Given two objects A,B ⊂ Rn
The Minkowski Difference is defined as the setA − B ⊂ R
n , where
A − B ={
a − b | a ∈ A ∧ b ∈ B}
If the sets A and B are convex then the Minkowski
Difference is also convex.
c© Knud Henriksen – p.5/11
![Page 33: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/33.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 34: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/34.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 35: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/35.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 36: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/36.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 37: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/37.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 38: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/38.jpg)
The Point Closest to Zero
Given a subset, C ⊂ Rn.
Then v(C) denotes the point nearest to the origin
v(C) ∈ C ∧ ||v(C)|| = min{
||x|| | x ∈ C}
C
O
v(C)
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.6/11
![Page 39: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/39.jpg)
Support Mapping
A support mapping function
sC : C ⊂ Rn −→ C ⊂ R
n
is a function which maps point p ∈ C to
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
c© Knud Henriksen – p.7/11
![Page 40: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/40.jpg)
Support Mapping
A support mapping function
sC : C ⊂ Rn −→ C ⊂ R
n
is a function which maps point p ∈ C to
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
c© Knud Henriksen – p.7/11
![Page 41: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/41.jpg)
Support Mapping
A support mapping function
sC : C ⊂ Rn −→ C ⊂ R
n
is a function which maps point p ∈ C to
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
c© Knud Henriksen – p.7/11
![Page 42: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/42.jpg)
Support Mapping
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
c© Knud Henriksen – p.8/11
![Page 43: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/43.jpg)
Support Mapping
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
OC
p
c© Knud Henriksen – p.8/11
![Page 44: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/44.jpg)
Support Mapping
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
OC
p
x
p · x
c© Knud Henriksen – p.8/11
![Page 45: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/45.jpg)
Support Mapping
sC(p) ∈ C ∧ p · sC(p) = max{
p · x | x ∈ C}
OC
sC(p)
p
c© Knud Henriksen – p.8/11
![Page 46: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/46.jpg)
Support Mapping
The value of a support mapping for a givenvector is called a support point.
It can be shown that the mapping
sA−B(v) = sA(v) − sB(−v)
is a support mapping of A − B.
That is, a support point for the Minkowski differ-
ence A−B can be computed from support points
for the original objects A and B.
c© Knud Henriksen – p.9/11
![Page 47: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/47.jpg)
Support Mapping
The value of a support mapping for a givenvector is called a support point.It can be shown that the mapping
sA−B(v) = sA(v) − sB(−v)
is a support mapping of A − B.
That is, a support point for the Minkowski differ-
ence A−B can be computed from support points
for the original objects A and B.
c© Knud Henriksen – p.9/11
![Page 48: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/48.jpg)
Support Mapping
The value of a support mapping for a givenvector is called a support point.It can be shown that the mapping
sA−B(v) = sA(v) − sB(−v)
is a support mapping of A − B.
That is, a support point for the Minkowski differ-
ence A−B can be computed from support points
for the original objects A and B.
c© Knud Henriksen – p.9/11
![Page 49: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/49.jpg)
The GJK Algorithm
The GJK Algorithm is a descent method forapproximating
v(A − B)
and therefore also
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.10/11
![Page 50: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/50.jpg)
The GJK Algorithm
The GJK Algorithm is a descent method forapproximating
v(A − B)
and therefore also
d(A,B) = ||v(A − B)||
c© Knud Henriksen – p.10/11
![Page 51: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/51.jpg)
The GJK Algorithm
A − B
o
c© Knud Henriksen – p.11/11
![Page 52: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/52.jpg)
The GJK Algorithm
A − B
o
v1
c© Knud Henriksen – p.11/11
![Page 53: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/53.jpg)
The GJK Algorithm
A − B
w1
o
v1
c© Knud Henriksen – p.11/11
![Page 54: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/54.jpg)
The GJK Algorithm
A − B
w1
o
v2
c© Knud Henriksen – p.11/11
![Page 55: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/55.jpg)
The GJK Algorithm
A − B
w1
w2
o
v2
c© Knud Henriksen – p.11/11
![Page 56: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/56.jpg)
The GJK Algorithm
A − B
w1
w2
o
c© Knud Henriksen – p.11/11
![Page 57: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/57.jpg)
The GJK Algorithm
A − B
w1
w2
v3
o
c© Knud Henriksen – p.11/11
![Page 58: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/58.jpg)
The GJK Algorithm
A − B
w1
w2
v3
o
w3
c© Knud Henriksen – p.11/11
![Page 59: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/59.jpg)
The GJK Algorithm
A − B
w1
w2
o
w3
c© Knud Henriksen – p.11/11
![Page 60: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/60.jpg)
The GJK Algorithm
A − B
w1
o
w3
c© Knud Henriksen – p.11/11
![Page 61: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/61.jpg)
The GJK Algorithm
A − B
w1
v4
o
w3
c© Knud Henriksen – p.11/11
![Page 62: The Gilbert-Johnson-Keerthi (GJK) Algorithmread.pudn.com/downloads298/sourcecode/graph/1332223... · Gilbert-Johnson-Keerthi (GJK) Christer Ericson Sony Computer Entertainment America](https://reader033.vdocuments.us/reader033/viewer/2022051511/6015a3de01252b4ee270f294/html5/thumbnails/62.jpg)
The GJK Algorithm
A − B
w1
v4
w4
o
w3
c© Knud Henriksen – p.11/11