inzombiak / GJK_EPA

Implementation of GJK algorithm in 2D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GJK/EPA

Implementation of GJK (Gilbert–Johnson–Keerthi) and EPA (Expanding Polytope Algorithm) algorithm's in 2D

Note: A lot of the functions are not optimized. I'll try to mark them at some point, but in general be aware that this is not an optimal implementation, just an implementation.

Note 2: Have not added support for concave shapes, although you can draw them.

Controls:

  • Q - switches between drawing and selecting mode. When drawing, a little red dot will follow the cursor
  • Drawing Mode:
    • Left Click - place vertex
    • Space - links the vertices in the order they were placed. Note: There is no testing for non-simple polygons yet, so KISS
  • Selecting Mode:
    • Left Click and Drag - move a shape around
    • Hold Left Click + Delete/Backspace - delete shape
    • Ctrl + Left Click - marks a shape. If 2 shapes are selected B replaces A and the new shape becomes B
    • Space - Calculates if intersecting

Build Requirements:

SFML 2.4.2 for rendering

References:

See Also:

About

Implementation of GJK algorithm in 2D

License:MIT License


Languages

Language:C++ 100.0%