Merge pull request #3450 from teerthsharma:topo/hullgraph-inverse-map
PiperOrigin-RevId: 958414730 Change-Id: I4a7f8fdde77513a3267e07e46a13144592e73ff0
This commit is contained in:
+17
-13
@@ -1947,20 +1947,24 @@ void mjCMesh::MakeGraph(const double* dvert) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// replace global ids with local ids in edge data
|
// replace global ids with local ids in edge data
|
||||||
for (int i=0; i < numvert+3*numface; i++) {
|
else {
|
||||||
if (edge_localid[i] >= 0) {
|
// invert vert_globalid: point id -> hull vertex index, -1 if not on hull.
|
||||||
// search vert_globalid for match
|
// every vert_globalid entry was range-checked above, so the index is safe.
|
||||||
int adr;
|
std::vector<int> hullid(nvert(), -1);
|
||||||
for (adr=0; adr < numvert; adr++) {
|
for (int adr=0; adr < numvert; adr++) {
|
||||||
if (vert_globalid[adr] == edge_localid[i]) {
|
hullid[vert_globalid[adr]] = adr;
|
||||||
edge_localid[i] = adr;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we found a match: SHOULD NOT OCCUR
|
for (int i=0; i < numvert+3*numface; i++) {
|
||||||
if (adr >= numvert) {
|
if (edge_localid[i] >= 0) {
|
||||||
mju_error("Vertex id not found in convex hull");
|
int adr = hullid[edge_localid[i]];
|
||||||
|
|
||||||
|
// make sure we found a match: SHOULD NOT OCCUR
|
||||||
|
if (adr < 0) {
|
||||||
|
mju_error("Vertex id not found in convex hull");
|
||||||
|
}
|
||||||
|
|
||||||
|
edge_localid[i] = adr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user