Auto-generate 3D mesh from convex OBJ if dim=3 in flex.

This requires the user to explicitly specify an origin.

PiperOrigin-RevId: 712483526
Change-Id: Ie316a5eccb676bb918d4bb746795019145c10f5b
This commit is contained in:
Alessio Quaglino
2025-01-06 04:34:49 -08:00
committed by Copybara-Service
parent 65048d6b8f
commit ee6f4837f3
8 changed files with 747 additions and 22 deletions
+16 -15
View File
@@ -231,21 +231,22 @@ mjtNum CompareModel(const mjModel* m1, const mjModel* m2,
#undef X
if (maxdif > 0) return maxdif;
// compare arrays, apart from bvh-related ones, as those are sensitive to
// numerical differences when meshes are perfectly symmetric.
#define X(type, name, nr, nc) \
if (strncmp(#name, "bvh_", 4)) { \
for (int r = 0; r < m1->nr; r++) { \
for (int c = 0; c < nc; c++) { \
dif = Compare(m1->name[r * nc + c], m2->name[r * nc + c]); \
if (dif > maxdif) { \
maxdif = dif; \
field = #name; \
field += " row: " + std::to_string(r); \
field += " col: " + std::to_string(c); \
} \
} \
} \
// compare arrays, apart from bvh-related ones (which includes flex_vert0), as
// those are sensitive to numerical differences when meshes are perfectly
// symmetric.
#define X(type, name, nr, nc) \
if (strncmp(#name, "bvh_", 4) && strncmp(#name, "flex_vert0", 4)) { \
for (int r = 0; r < m1->nr; r++) { \
for (int c = 0; c < nc; c++) { \
dif = Compare(m1->name[r * nc + c], m2->name[r * nc + c]); \
if (dif > maxdif) { \
maxdif = dif; \
field = #name; \
field += " row: " + std::to_string(r); \
field += " col: " + std::to_string(c); \
} \
} \
} \
} // NOLINT
MJMODEL_POINTERS
#undef X