Move computation of flex_vert0 to user_mesh.cc.

This removes the dependency of flex_vert0 from mj_flex and mjData.

PiperOrigin-RevId: 700382297
Change-Id: I0b6d023c2e1ba14fa92417b65bfc288f37c223ae
This commit is contained in:
Alessio Quaglino
2024-11-26 10:16:16 -08:00
committed by Copybara-Service
parent b716837395
commit 203602b01f
4 changed files with 15 additions and 12 deletions
-12
View File
@@ -120,18 +120,6 @@ static void set0(mjModel* m, mjData* d) {
m->light_mode[i] = lightmode[i];
}
// compute bounding box coordinates
for (int i=0; i < m->nflex; i++) {
int bvhadr = m->flex_bvhadr[i];
const mjtNum* bvh = d->bvh_aabb_dyn + 6*(bvhadr - m->nbvhstatic);
for (int j=0; j < m->nflexvert; j++) {
for (int k=0; k < 3; k++) {
mjtNum size = 2*(bvh[3+k] - m->flex_radius[i]);
m->flex_vert0[3*j+k] = (d->flexvert_xpos[3*j+k] - bvh[k]) / size + 0.5;
}
}
}
// copy fields
mju_copy(m->flexedge_length0, d->flexedge_length, m->nflexedge);
mju_copy(m->tendon_length0, d->ten_length, m->ntendon);