Prevent ray casting from stopping at the SDF bounding box.
The SDF value of the closest point on the bounding box is added to the distance from the bounding box when the query point is outside of it. PiperOrigin-RevId: 788377943 Change-Id: Id8e489a1d112918c484f5615223d557f2d14b822
This commit is contained in:
committed by
Copybara-Service
parent
a04e0385e4
commit
4575089f48
@@ -153,14 +153,11 @@ mjtNum oct_distance(const mjModel* m, const mjtNum p[3], int meshid) {
|
||||
mjtNum sdf = 0;
|
||||
mjtNum point[3] = {p[0], p[1], p[2]};
|
||||
mjtNum boxDist = boxProjection(point, oct_aabb);
|
||||
if (boxDist > 0) {
|
||||
return boxDist;
|
||||
}
|
||||
int node = findOct(w, NULL, oct_aabb, oct_child, point);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
sdf += w[i] * oct_coeff[8*node + i];
|
||||
}
|
||||
return sdf;
|
||||
return sdf + boxDist > 0 ? sdf + boxDist : sdf;
|
||||
}
|
||||
|
||||
// gradient of sdf
|
||||
|
||||
Reference in New Issue
Block a user