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:
Alessio Quaglino
2023-04-17 10:29:36 -07:00
committed by Copybara-Service
parent 27742da9d7
commit c943797591
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -1047,7 +1047,7 @@ void mjCMesh::Process() {
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(vec, nrm) * a / 3;
// if legacy computation requested, then always positive
if (!model->exactmeshinertia) {
if (!model->exactmeshinertia && type==mjVOLUME_MESH) {
vol = fabs(vol);
}
@@ -1093,7 +1093,7 @@ void mjCMesh::Process() {
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(cen, nrm) * a / 3;
// if legacy computation requested, then always positive
if (!model->exactmeshinertia) {
if (!model->exactmeshinertia && type==mjVOLUME_MESH) {
vol = fabs(vol);
}
+1 -1
View File
@@ -1201,7 +1201,7 @@ double mjCGeom::GetVolume(void) {
}
mjCMesh* pmesh = model->meshes[meshid];
if (model->exactmeshinertia) {
if (model->exactmeshinertia || typeinertia==mjSHELL_MESH) {
return pmesh->GetVolumeRef(typeinertia);
} else {
return pmesh->boxsz_volume[0]*pmesh->boxsz_volume[1]*pmesh->boxsz_volume[2]*8;
+1 -1
View File
@@ -1,5 +1,5 @@
<mujoco>
<compiler exactmeshinertia="true"/>
<compiler/>
<asset>
<mesh file="cube.obj" name="hollow_cube"/>
</asset>