Restore legacy center-of-mass computation when exactmeshinertia is false.
PiperOrigin-RevId: 464511268 Change-Id: Ic7c640d01e58dba5049e9fcb2c1b75d6bff4f956
This commit is contained in:
committed by
Copybara-Service
parent
3d77eb1ef4
commit
f15bcd04b5
@@ -993,9 +993,14 @@ void mjCMesh::Process() {
|
||||
// compute and add volume
|
||||
const double vec[3] = {cen[0]-facecen[0], cen[1]-facecen[1], cen[2]-facecen[2]};
|
||||
double vol = type==mjSHELL_MESH ? a : mjuu_dot3(vec, nrm) * a / 3;
|
||||
GetVolumeRef(type) += vol;
|
||||
|
||||
// if legacy computation requested, then always positive
|
||||
if (!model->exactmeshinertia) {
|
||||
vol = fabs(vol);
|
||||
}
|
||||
|
||||
// add pyramid com
|
||||
GetVolumeRef(type) += vol;
|
||||
for (j=0; j<3; j++) {
|
||||
CoM[j] += vol*(cen[j]*3.0/4.0 + facecen[j]/4.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user