Support arbitrary large meshes in multiccd by reusing EPA memory.

PiperOrigin-RevId: 947709621
Change-Id: Idc4f168434b9d0a8555c0bed989adb0e99770a78
This commit is contained in:
Kyle Bayes
2026-07-14 08:47:52 -07:00
committed by Copybara-Service
parent 0afafacfc5
commit 2444defc63
18 changed files with 680 additions and 87 deletions
+3 -4
View File
@@ -19,7 +19,6 @@
#include <stddef.h>
#include <mujoco/mjexport.h>
#include <mujoco/mjmodel.h>
#include <mujoco/mjtype.h>
#include "engine/engine_collision_convex.h"
@@ -43,8 +42,6 @@ extern "C" {
#define mjEDGE_TOL 0.00159999931
#endif
// max number of supported vertices in a polygon face of a mesh
#define mjMAX_POLYVERT 150
// Status of an EPA run
typedef enum {
@@ -77,6 +74,8 @@ typedef struct {
int max_contacts; // set to max number of contact points to recover
mjtNum dist_cutoff; // set to max geom distance to recover
void* buffer; // buffer memory for polytope (should be sized given by mjc_ccdSize)
int npolygonmax; // max number of vertices in a mesh polygon
int nmeshdegmax; // max number of edges adjacent to a mesh vertex
} mjCCDConfig;
// data produced from running GJK and EPA
@@ -102,7 +101,7 @@ typedef struct {
} mjCCDStatus;
// return size in bytes of the buffer needed for mjc_ccd for a given number of iterations
MJAPI size_t mjc_ccdSize(int iterations);
MJAPI size_t mjc_ccdSize(int npolygonmax, int nmeshdegmax, int iterations);
// run general convex collision detection, returns positive for distance, negative for penetration
MJAPI mjtNum mjc_ccd(const mjCCDConfig* config, mjCCDStatus* status, mjCCDObj* obj1, mjCCDObj* obj2);