Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 381 – Advanced Game Programming GJK. GJK Gilbert – Johnson – Keerthi distance algorithm Used to determine the minimum distance between convex sets.

Similar presentations


Presentation on theme: "CSE 381 – Advanced Game Programming GJK. GJK Gilbert – Johnson – Keerthi distance algorithm Used to determine the minimum distance between convex sets."— Presentation transcript:

1 CSE 381 – Advanced Game Programming GJK

2 GJK Gilbert – Johnson – Keerthi distance algorithm Used to determine the minimum distance between convex sets Why? –to see if they are colliding –to see where they are colliding

3 What’s a convex set? What does convex mean? Convex Test: –For all the shape’s vertices: Make a line between each pair Is entire line inside object? –If yes, it is convex –If no, it is not (i.e., has dent)

4 Convex Set vs. Hull Convex Set –a set of points representing a convex shape Convex Hull –a minimal convex set –minimally snugly fits points (rubber band analogy)

5 Minkowski Sum What’s that? –A mathematical operation performed on 2 shapes A B = All Points in A + All Points in B How many points do we end up with? –A * B

6 Visualizing Minkowski Sums Results in swept shapes A B A B

7 Minkowski Difference The Opposite of a Minkowski Sum A B = All Points in A – All Points in B How many points do we end up with? –A * B

8 Visualizing Minkowski Differences Results in swept shapes A B A B

9 An Interesting Detail For Minkowski Difference A B If A and B are intersecting, A B contains origin A B A B

10 Now Let’s Get Back To GJK Assume we have two shapes, A & B We want to know if A & B intersect

11 GJK for A & B Collision Test 1.Calculate Minkowski Difference 2.Select any Minkowski Difference point 3.Start at that point, and try to get to origin by visiting other points. –remember, this is a convex set 4.Build polytope using 4 points –iteratively update to find next one 5.If any polytope along way contains origin, no collision 6.If polytope never contains origin, no collision

12 Visualizing GJK Miss (no collision) Note: I’ve simplified things a bit for rendering

13 Visualizing GJK Hit (collision)


Download ppt "CSE 381 – Advanced Game Programming GJK. GJK Gilbert – Johnson – Keerthi distance algorithm Used to determine the minimum distance between convex sets."

Similar presentations


Ads by Google