Improvements to GJK implementation:

- Fix various bugs
- Improve readability
- Add support for recovering witness points.

PiperOrigin-RevId: 646515019
Change-Id: I295cf90d885e32013e595ea7aad07ed6c1869239
This commit is contained in:
Kyle Bayes
2024-06-25 09:59:52 -07:00
committed by Copybara-Service
parent 5a513a0afb
commit 5e39fc0564
5 changed files with 214 additions and 108 deletions
+7 -6
View File
@@ -23,15 +23,16 @@
extern "C" {
#endif
// internal struct with settings for GJK
struct _mjGjkConfig {
mjtNum max_iterations;
// internal configuration for convex collision detection
struct _mjCCDConfig {
int max_iterations;
mjtNum tolerance;
};
typedef struct _mjGjkConfig mjGjkConfig;
typedef struct _mjCCDConfig mjCCDConfig;
// Returns the distance between the two objects given an initial guess x0.
MJAPI mjtNum mj_gjk(const mjGjkConfig* config, mjtCCObj* obj1, mjtCCObj* obj2, const mjtNum x0[3]);
// Returns the distance between the two objects. The witness points are
// recoverable from x_0 in obj1 and obj2.
MJAPI mjtNum mj_gjk(const mjCCDConfig* config, mjCCDObj* obj1, mjCCDObj* obj2);
#ifdef __cplusplus
}