Store pointer to index in mjCBoundingVolume if possible.

PiperOrigin-RevId: 598592242
Change-Id: I8dc20a8d8a9a0e967688839fa22d75263c226958
This commit is contained in:
Alessio Quaglino
2024-01-15 06:03:28 -08:00
committed by Copybara-Service
parent cab1c6bb39
commit acf698e2df
4 changed files with 24 additions and 11 deletions
+3 -3
View File
@@ -372,7 +372,7 @@ int mjCBoundingVolumeHierarchy::MakeBVH(std::vector<const mjCBoundingVolume*>& e
int index = nbvh++;
child.push_back(-1);
child.push_back(-1);
nodeid.push_back(-1);
nodeid.push_back(nullptr);
level.push_back(lev);
// store bounding box of the current node
@@ -388,7 +388,7 @@ int mjCBoundingVolumeHierarchy::MakeBVH(std::vector<const mjCBoundingVolume*>& e
for (int i=0; i<2; i++) {
child[2*index+i] = -1;
}
nodeid[index] = elements[0]->id;
nodeid[index] = (int*)elements[0]->GetId();
return index;
}
@@ -1412,7 +1412,7 @@ double mjCGeom::GetVolume(void) {
void mjCGeom::SetBoundingVolume(mjCBoundingVolume* bv) const {
bv->id = id;
bv->SetId(&id);
bv->contype = contype;
bv->conaffinity = conaffinity;
bv->aabb = aabb;