The Gilbert-Johnson-Keerthi (GJK) Algorithm

Содержание

Слайд 2

Talk outline What is the GJK algorithm Terminology “Simplified” version of

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
Слайд 3

GJK solves proximity queries Given two convex polyhedra Computes distance d

GJK solves proximity queries

Given two convex polyhedra
Computes distance d
Can also return

closest pair of points PA, PB
Слайд 4

GJK solves proximity queries Generalized for arbitrary convex objects As long

GJK solves proximity queries

Generalized for arbitrary convex objects
As long as they

can be described in terms of a support mapping function
Слайд 5

Terminology 1(3) Supporting (or extreme) point for direction returned by support mapping function

Terminology 1(3)

Supporting (or extreme) point

for direction

returned by support mapping function

Слайд 6

Terminology 2(3) 0-simplex 1-simplex 2-simplex 3-simplex simplex

Terminology 2(3)

0-simplex

1-simplex

2-simplex

3-simplex

simplex

Слайд 7

Terminology 3(3) Point set C Convex hull, CH(C)

Terminology 3(3)

Point set C

Convex hull, CH(C)

Слайд 8

The GJK algorithm Initialize the simplex set Q with up to

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
Слайд 9

GJK example 1(10) INPUT: Convex polyhedron C given as the convex

GJK example 1(10)

INPUT: Convex polyhedron C given as the convex hull

of a set of points
Слайд 10

Initialize the simplex set Q with up to d+1 points from

Initialize the simplex set Q with up to d+1 points from

C (in d dimensions)

GJK example 2(10)

Слайд 11

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

GJK example 3(10)

Compute point P of minimum norm in CH(Q)

Слайд 12

GJK example 4(10) If P is the origin, exit; return 0

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’)
Слайд 13

GJK example 5(10) Let V=SC(–P) be a supporting point in direction –P

GJK example 5(10)

Let V=SC(–P) be a supporting point in direction –P

Слайд 14

GJK example 6(10) If V no more extreme 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
Слайд 15

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

GJK example 7(10)

Compute point P of minimum norm in CH(Q)

Слайд 16

GJK example 8(10) If P is the origin, exit; return 0

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’)
Слайд 17

GJK example 9(10) Let V=SC(–P) be a supporting point in direction –P

GJK example 9(10)

Let V=SC(–P) be a supporting point in direction –P

Слайд 18

GJK example 10(10) DONE! If V no more extreme in direction

GJK example 10(10)

DONE!

If V no more extreme in direction –P than

P itself, exit; return ||P||
Слайд 19

Distance subalgorithm 1(2) Approach #1: Solve algebraically Used in original GJK

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
Слайд 20

Distance subalgorithm 2(2) Approach #2: Solve geometrically Mathematically equivalent But more

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
Слайд 21

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

Closest point on triangle

ClosestPointOnTriangleToPoint()
Finds point on triangle closest to a given

point
Слайд 22

Closest point on triangle Separate cases based on which feature Voronoi region point lies in

Closest point on triangle

Separate cases based on which feature Voronoi region

point lies in
Слайд 23

Closest point on triangle

Closest point on triangle

Слайд 24

Closest point on triangle

Closest point on triangle

Слайд 25

GJK for two objects What about two polyhedra, A and B?

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
Слайд 26

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

Minkowski sum & difference

Minkowski sum
The sweeping of one convex object with

another
Defined as:
Слайд 27

Minkowski sum & difference Minkowski difference, defined as: Can write distance

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!
Слайд 28

The generalization A and B intersecting iff A–B contains the origin!

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!
Слайд 29

GJK for moving objects

GJK for moving objects

Слайд 30

Transform the problem…

Transform the problem…

Слайд 31

…into moving vs stationary

…into moving vs stationary

Слайд 32

Alt #1: Point duplication Let object A additionally include the points

Alt #1: Point duplication

Let object A additionally include the points

…effectively forming

the convex hull of the swept volume of A
Слайд 33

Alt #2: Support mapping Modify support mapping to consider only points when

Alt #2: Support mapping

Modify support mapping to consider only points

when

Слайд 34

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

Alt #2: Support mapping

…and to consider only points

when

Слайд 35

GJK for moving objects Presented solution Gives only Boolean interference detection

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