Replace flex_xvert0 with flex_vert0
`flex_xvert0` stored the Cartesian position of the vertices in `qpos0`. This array was unused, so it is now replaced with `flex_vert0`, which still contains the positions of the vertices, but normalized on the bounding box of the flex so that the coordinates are in `[0,1]^m->flex_dim`. This will be useful in the future for using different interpolation methods for computing flex deformations. PiperOrigin-RevId: 691779361 Change-Id: I5c4223103cd4558f4e268fe3e8d8177541e4754f
This commit is contained in:
committed by
Copybara-Service
parent
26ccaeb78e
commit
94bbf297fc
@@ -118,8 +118,19 @@ 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->flex_xvert0, d->flexvert_xpos, 3*m->nflexvert);
|
||||
mju_copy(m->flexedge_length0, d->flexedge_length, m->nflexedge);
|
||||
mju_copy(m->tendon_length0, d->ten_length, m->ntendon);
|
||||
mju_copy(m->actuator_length0, d->actuator_length, m->nu);
|
||||
|
||||
Reference in New Issue
Block a user