Asteroid_game_with_physics
ConvexBodyProximityQueries.jl
Asteroid_game_with_physics | ConvexBodyProximityQueries.jl | |
---|---|---|
1 | 1 | |
4 | 22 | |
- | - | |
0.0 | 1.8 | |
about 2 years ago | over 2 years ago | |
Processing | Julia | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Asteroid_game_with_physics
-
Asteroid game with minimal physics using GJK algorithm as collision detection
Source code: https://github.com/volfegan/Asteroid_game_with_physics
ConvexBodyProximityQueries.jl
-
GJK: Collision detection algorithm in 2D/3D
I should be writing a thesis about AI but got inside the collision rabbit hole so I have this fresh.
From the description of the algorithm you are doing I think you are thinking about Lin-Canny or V-Clip, which certainly may have that kind of numerical error problems.
GJK has also numerical problems but they are different. In principle it shouldn't be affected by coplanarity of several faces since you just need the vertex with highest support for a given direction. It could be a problem if you find the support point by hill climbing from vertex to vertex. GJK however does have numerical problems but they are of a different kind related to the degeneracy of the simplices it computes.
But you are so right about the subtetly of the problem: there is a very fine thread between infinite looping and incorrect answers. I have been bitten by this trying to implement geometric algos. There should be a special hell for people that output coplanar faces.
I know one of Bullet Physics/MuJoCo has the GJK, not remember which one. If anyone is curious I know of two Julia implementations:
https://github.com/JuliaRobotics/EnhancedGJK.jl
and my favorite: https://github.com/arlk/ConvexBodyProximityQueries.jl
This latter one is great as you are just required to implement the support function and are ready to go. Julia performance is great if you are concerned about using a dynamic language (i.e: ~2us for collision between two convex bodies of 1000 faces each)
Finally, about the convex hull computation it looks like some kind of solved problem, I mean, O(n log(n)) for 3D. Wrong!!!! QHull in this regard is fantastic as it has several heuristics to solve problems caused by finite precision, not to mention that I think worse case is O(n^2) as it doesn't implement the asymptotically optimal algo (not sure...). If you scale to more dimensions, which could happen even in if 3D because you transformed your problem to a convex hull problem you will be hit with O(n^2), bad news. There are several other libraries (CCD, LRSLib and more) that allow you to use arbitrary precision but you will get something like a 100x penalization for the luxury.
What are some alternatives?
pymunk - Pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python
JoltPhysics - A multi core friendly rigid body physics and collision detection library, written in C++, suitable for games and VR applications.
polybooljs - Boolean operations on polygons (union, intersection, difference, xor)
BEPUphysics - Pure C# 3D real time physics simulation library, now with a higher version number.
GeometricAlgorithms - Geometric Algorithms implemented for Java Processing v3
EnhancedGJK.jl - GJK signed distance algorithm for convex bodies in Julia
clipper-lib - Boolean operations and offsetting library in Javascript