Specify is volume is too small or negative in mesh error messages. Fixes #799.
PiperOrigin-RevId: 525151156 Change-Id: Ia0e9d8b900b8c372e9229da934a4eb7aeb1a3b7a
This commit is contained in:
committed by
Copybara-Service
parent
d7ec409eb6
commit
94c4f72907
@@ -124,7 +124,7 @@ mjCMesh::mjCMesh(mjCModel* _model, mjCDef* _def) {
|
||||
invalidorientation.first = -1;
|
||||
invalidorientation.second = -1;
|
||||
validarea = true;
|
||||
validvolume = true;
|
||||
validvolume = 1;
|
||||
valideigenvalue = true;
|
||||
validinequality = true;
|
||||
processed = false;
|
||||
@@ -1060,7 +1060,7 @@ void mjCMesh::Process() {
|
||||
|
||||
// require positive volume
|
||||
if (GetVolumeRef(type) < mjMINVAL) {
|
||||
validvolume = false;
|
||||
validvolume = GetVolumeRef(type) < 0 ? -1 : 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1196,6 +1196,8 @@ void mjCMesh::CheckMesh() {
|
||||
name.c_str(), invalidorientation.first, invalidorientation.second);
|
||||
if (!validarea)
|
||||
throw mjCError(this, "mesh surface area is too small: %s", name.c_str());
|
||||
if (validvolume<0)
|
||||
throw mjCError(this, "mesh volume is negative (misoriented triangles): %s", name.c_str());
|
||||
if (!validvolume)
|
||||
throw mjCError(this, "mesh volume is too small: %s", name.c_str());
|
||||
if (!valideigenvalue)
|
||||
|
||||
@@ -511,7 +511,7 @@ class mjCMesh: public mjCBase {
|
||||
// mesh properties that indicate a well-formed mesh
|
||||
std::pair<int, int> invalidorientation; // indices of invalid edge; -1 if none
|
||||
bool validarea; // false if the area is too small
|
||||
bool validvolume; // false if the volume is too small
|
||||
int validvolume; // 0: volume is too small, -1: volume is negative
|
||||
bool valideigenvalue; // false if inertia eigenvalue is too small
|
||||
bool validinequality; // false if inertia inequality is not satisfied
|
||||
bool processed; // false if the mesh has not been processed yet
|
||||
|
||||
Reference in New Issue
Block a user