Back out of gjkIntersect when convergence fails due to algorithm oscillating between two support points. Also, fix related bug in box support function.

PiperOrigin-RevId: 696482893
Change-Id: Icedaf5489b761b8bf03ec30558b5d1128668a647
This commit is contained in:
Kyle Bayes
2024-11-14 05:11:30 -08:00
committed by Copybara-Service
parent 536c60a0ac
commit 0a0de6615d
2 changed files with 18 additions and 6 deletions
+3 -3
View File
@@ -276,9 +276,9 @@ static void mjc_boxSupport(mjtNum res[3], mjCCDObj* obj, const mjtNum dir[3]) {
mjtNum local_dir[3], tmp[3];
mulMatTVec3(local_dir, mat, dir);
tmp[0] = mju_sign(local_dir[0]) * size[0];
tmp[1] = mju_sign(local_dir[1]) * size[1];
tmp[2] = mju_sign(local_dir[2]) * size[2];
tmp[0] = (local_dir[0] >= 0 ? 1 : -1) * size[0];
tmp[1] = (local_dir[1] >= 0 ? 1 : -1) * size[1];
tmp[2] = (local_dir[2] >= 0 ? 1 : -1) * size[2];
// transform result to global frame
localToGlobal(res, mat, tmp, pos);