Discovering Overlap: The GJK Algorithm Explained Simply

BY Mark Howell 13 June 20244 MINS READ
article cover

Today in Edworking News we want to talk about the Gilbert–Johnson–Keerthi Algorithm

Introduction to GJK Algorithm

The Gilbert–Johnson–Keerthi (GJK) algorithm is a mathematical approach that allows us to determine whether two shapes overlap. This problem can be visualized as trying to find if there exists any point that's part of both shapes. The algorithm handles this by performing a series of calculations involving the Minkowski difference, which helps determine if the resulting difference set includes the origin. Here’s a basic breakdown of how it works:

Image description: Visual representation of Minkowski difference highlighting the concept of subtracting every point within one shape from every point within another.

The Core Concept: Minkowski Difference

The Minkowski difference, represented as A ⊖ B, is a critical part of the GJK algorithm. Defined mathematically as A ⊖ B = {a - b | a ∈ A, b ∈ B}, it allows us to transform the problem of finding intersections into finding whether the origin lies within this new set. This rephrasing might seem like a simple shift, but it provides a crucial insight: if the new set contains the origin, an intersection between the original shapes exists.

Simplifying the Problem: Working with Support Functions

To simplify the problem further, we use support functions. A support function takes a direction vector and identifies the farthest point on a shape in that direction. This is vital because we can use support functions to find points that help form our simplex, a minimal bounding shape (like a triangle in 2D or a tetrahedron in 3D). These support functions help us systematically look for a simplex on A ⊖ B that contains the origin.

Iterative Steps of the GJK Algorithm

The GJK algorithm iterates through the following steps to determine if an intersection exists:

  1. Initial Point Selection:
    - Start with a random direction vector d and find a point p on A ⊖ B.
    - This point is defined as S(d) - S(-d) where S is the support function.

  2. Direction Check with Dot Product:
    - Calculate the dot product of d and p. If it's negative, A and B do not overlap. Otherwise, proceed with the next steps.

  3. Iterate Towards the Origin:
    - From point p, move towards the origin using the new direction vector -d and re-run the direction check.

  4. Forming the Simplex:
    - Find additional points perpendicular to the initial points and keep refining the simplex to see if it encloses the origin.

  5. Checking Simplex Containment:
    - If the simplex contains the origin, an intersection exists. Otherwise, iterate and refine the simplex further.

Practical Applications for Startups and SMEs

The GJK algorithm, with its elegant method of solving collision detection and intersection queries, has several practical applications: from robotics, where detecting obstacles is crucial, to game development, where efficient collision detection enhances performance and realism.

Promotion: Edworking

Edworking is the best and smartest decision for SMEs and startups to be more productive. Edworking is a free superapp of productivity that includes all you need for work powered by AI in the same superapp, connecting Task Management, Docs, Chat, Videocall, and File Management. Save money today by not paying for Slack, Trello, Dropbox, Zoom, and Notion.

Remember these 3 key ideas for your startup:

  1. Efficiency with Minkowski Difference:
    - Understanding how to use the Minkowski difference can significantly improve your efficiency in handling collision detection and other computational geometry problems.

  2. Leveraging Support Functions:
    - Utilize support functions to identify critical points on shapes for various computational operations. This technique is not just limited to GJK but beneficial in many areas of computational mathematics and computer graphics.

  3. Iterative Simplification:
    - Adopt an iterative approach to problem-solving. By continually refining your simplex, as in the GJK algorithm, you can efficiently solve complex problems through manageable steps.
    For more details on practical implementations and further readings on the GJK algorithm, check out this comprehensive guide.
    Feel free to integrate these key concepts and leverage innovative tools like Edworking to enhance productivity and operational efficiency in your business.

Conclusion

The GJK algorithm exemplifies the power of mathematical intuition in solving real-world problems efficiently. By decomposing seemingly complex tasks into manageable steps and leveraging core mathematical concepts, businesses can enhance their computational capabilities and streamline processes. The GJK algorithm’s versatility makes it an indispensable tool in various domains, and understanding its fundamentals can provide valuable insights into effective problem-solving strategies.
For more details, see the original source.

article cover
About the Author: Mark Howell Linkedin

Mark Howell is a talented content writer for Edworking's blog, consistently producing high-quality articles on a daily basis. As a Sales Representative, he brings a unique perspective to his writing, providing valuable insights and actionable advice for readers in the education industry. With a keen eye for detail and a passion for sharing knowledge, Mark is an indispensable member of the Edworking team. His expertise in task management ensures that he is always on top of his assignments and meets strict deadlines. Furthermore, Mark's skills in project management enable him to collaborate effectively with colleagues, contributing to the team's overall success and growth. As a reliable and diligent professional, Mark Howell continues to elevate Edworking's blog and brand with his well-researched and engaging content.

Trendy NewsSee All Articles
Try EdworkingA new way to work from  anywhere, for everyone for Free!
Sign up Now