Print vertex IDs when inconsistent face is found.
PiperOrigin-RevId: 493311839 Change-Id: I0283d86bc6092fbe4f47b845fa8ec212bffdfa1a
This commit is contained in:
committed by
Copybara-Service
parent
e4f1d584ad
commit
7f459ab8ca
@@ -114,7 +114,8 @@ mjCMesh::mjCMesh(mjCModel* _model, mjCDef* _def) {
|
||||
face = NULL;
|
||||
graph = NULL;
|
||||
needhull = false;
|
||||
validorientation = true;
|
||||
invalidorientation.first = -1;
|
||||
invalidorientation.second = -1;
|
||||
validarea = true;
|
||||
validvolume = true;
|
||||
valideigenvalue = true;
|
||||
@@ -275,7 +276,8 @@ void mjCMesh::Compile(const mjVFS* vfs) {
|
||||
std::sort(useredge.begin(), useredge.end());
|
||||
auto iterator = std::adjacent_find(useredge.begin(), useredge.end());
|
||||
if (iterator != useredge.end()) {
|
||||
validorientation = false;
|
||||
invalidorientation.first = iterator->first+1;
|
||||
invalidorientation.second = iterator->second+1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,8 +1197,11 @@ void mjCMesh::CheckMesh() {
|
||||
if (!processed) {
|
||||
return;
|
||||
}
|
||||
if (!validorientation)
|
||||
throw mjCError(this, "faces have inconsistent orientation: %s", name.c_str());
|
||||
if (invalidorientation.first>=0 || invalidorientation.second>=0)
|
||||
throw mjCError(this,
|
||||
"faces of mesh '%s' have inconsistent orientation. Please check the "
|
||||
"faces containing the vertices %d and %d.",
|
||||
name.c_str(), invalidorientation.first, invalidorientation.second);
|
||||
if (!validarea)
|
||||
throw mjCError(this, "mesh surface area is too small: %s", name.c_str());
|
||||
if (!validvolume)
|
||||
|
||||
@@ -494,12 +494,12 @@ class mjCMesh: public mjCBase {
|
||||
void CheckMesh(void); // check if the mesh is valid
|
||||
|
||||
// mesh properties that indicate a well-formed mesh
|
||||
bool validorientation; // false if mesh have inconsistent faces
|
||||
bool validarea; // false if the area is too small
|
||||
bool validvolume; // false if the volume is too small
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
// mesh properties computed by Compile
|
||||
double pos_volume[3]; // CoM position
|
||||
|
||||
Reference in New Issue
Block a user