Enable interior nodes for interpolated flex shell mode.

Previously shell mode required cellcount=1 along at least one axis. This CL
adds support for cellcount > 1 in all three axes by pinning interior grid nodes
to the parent body and reconstructing their positions from boundary nodes via
Transfinite Interpolation (TFI).

PiperOrigin-RevId: 924314800
Change-Id: I8c2438f4866dd4133feed65f535a1ab69f0c9188
This commit is contained in:
Alessio Quaglino
2026-05-31 10:35:16 -07:00
committed by Copybara-Service
parent 4548e81e4d
commit 91c92279d2
14 changed files with 681 additions and 39 deletions
+8 -1
View File
@@ -873,14 +873,21 @@ int mjv_select(const mjModel* m, const mjData* d, const mjvOption* vopt,
mju_cellLookup(coord, m->flex_cellnum+3*i, order, loc, nodeindices);
// find node with largest weight in this cell
// in shell mode, skip interior nodes (pinned to worldbody)
int nodeid = -1;
int nstart = m->flex_nodeadr[i];
mjtNum w = 0;
int shell_mode = m->flex_interp[i] < 0;
for (int j = 0; j < npc; j++) {
mjtNum ww = mju_evalBasis(loc, j, order);
int nid = nodeindices[j];
// skip interior nodes in shell mode (they map to worldbody)
if (shell_mode && m->body_dofnum[m->flex_nodebodyid[nstart + nid]] == 0) {
continue;
}
if (ww > w) {
w = ww;
nodeid = nodeindices[j];
nodeid = nid;
}
}
flexbodyid = m->flex_nodebodyid[nstart + nodeid];