Make shellinertia ignore exactmeshinertia, which is only used for legacy volume computations. Fixes #759.
PiperOrigin-RevId: 524884880 Change-Id: Ia5b64ee33802866f792cdad4acfec6d9baf2a9e9
This commit is contained in:
committed by
Copybara-Service
parent
27742da9d7
commit
c943797591
@@ -1047,7 +1047,7 @@ void mjCMesh::Process() {
|
|||||||
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(vec, nrm) * a / 3;
|
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(vec, nrm) * a / 3;
|
||||||
|
|
||||||
// if legacy computation requested, then always positive
|
// if legacy computation requested, then always positive
|
||||||
if (!model->exactmeshinertia) {
|
if (!model->exactmeshinertia && type==mjVOLUME_MESH) {
|
||||||
vol = fabs(vol);
|
vol = fabs(vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1093,7 +1093,7 @@ void mjCMesh::Process() {
|
|||||||
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(cen, nrm) * a / 3;
|
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(cen, nrm) * a / 3;
|
||||||
|
|
||||||
// if legacy computation requested, then always positive
|
// if legacy computation requested, then always positive
|
||||||
if (!model->exactmeshinertia) {
|
if (!model->exactmeshinertia && type==mjVOLUME_MESH) {
|
||||||
vol = fabs(vol);
|
vol = fabs(vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1201,7 +1201,7 @@ double mjCGeom::GetVolume(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mjCMesh* pmesh = model->meshes[meshid];
|
mjCMesh* pmesh = model->meshes[meshid];
|
||||||
if (model->exactmeshinertia) {
|
if (model->exactmeshinertia || typeinertia==mjSHELL_MESH) {
|
||||||
return pmesh->GetVolumeRef(typeinertia);
|
return pmesh->GetVolumeRef(typeinertia);
|
||||||
} else {
|
} else {
|
||||||
return pmesh->boxsz_volume[0]*pmesh->boxsz_volume[1]*pmesh->boxsz_volume[2]*8;
|
return pmesh->boxsz_volume[0]*pmesh->boxsz_volume[1]*pmesh->boxsz_volume[2]*8;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<mujoco>
|
<mujoco>
|
||||||
<compiler exactmeshinertia="true"/>
|
<compiler/>
|
||||||
<asset>
|
<asset>
|
||||||
<mesh file="cube.obj" name="hollow_cube"/>
|
<mesh file="cube.obj" name="hollow_cube"/>
|
||||||
</asset>
|
</asset>
|
||||||
|
|||||||
Reference in New Issue
Block a user