L-Geo
2D Geometry library, written in Rust and based on lmaths.
Provides classic 2D shapes, such as :
- Circles
- Rectangles
- Convex Polygons
It implements the GJK algorithm to compute collision and EPA (yet to be developped) to extrude collision informations.
Examples :
First, always create a GJK struct, which hold your settings, like the contact tolerance :
let gjk = GJKnew;
Then you can start spawning shapes :
let c = new;
let r = AABBnew;
let p = new;
Finally, you can check for collisions between them.
Converting the result to a boolean is done by calling result.is_some(), as the intersect() function return the final Simplex of GJK.
let c_vs_r = gjk.intersect.is_some; // False
let c_vs_p = gjk.intersect.is_some; // False
let r_vs_p = gjk.intersect.is_some; // True