Compute the interpolation coefficients per vertex rather than per node.

PiperOrigin-RevId: 792124681
Change-Id: Ib0e18d0b59f09c7e3bdb2ef9940a9b7327b92cd3
This commit is contained in:
Alessio Quaglino
2025-08-07 06:01:58 -07:00
committed by Copybara-Service
parent 781242ae95
commit eb1da7c43d
2 changed files with 8 additions and 3 deletions
+6 -2
View File
@@ -780,11 +780,15 @@ void mjCMesh::TryCompile(const mjVFS* vfs) {
if (!plugin.active) {
tmd::TriangleMeshDistance sdf(vert_.data(), nvert(), face_.data(), nface());
std::vector<double> coeffs(octree_.NumVerts());
for (int i = 0; i < octree_.NumVerts(); ++i) {
coeffs[i] = sdf.signed_distance(octree_.Vert(i)).distance;
}
// TODO: the value at hanging vertices should be computed from the parent
for (int i = 0; i < octree_.NumNodes(); ++i) {
for (int j = 0; j < 8; j++) {
const double* v = octree_.Vert(i, j);
octree_.AddCoeff(i, j, sdf.signed_distance(v).distance);
octree_.AddCoeff(i, j, coeffs[octree_.VertId(i, j)]);
}
}
}