Speed up mesh support function with warmstarts.

PiperOrigin-RevId: 664807396
Change-Id: I9124e65efd9140a8e858b7b6be0867c26961477b
This commit is contained in:
Yuval Tassa
2024-08-19 07:54:01 -07:00
committed by Copybara-Service
parent 6241814ad7
commit 0fa39164f7
+5 -5
View File
@@ -219,11 +219,11 @@ void mjc_support(mjtNum res[3], mjCCDObj* obj, const mjtNum dir[3]) {
vert_globalid = m->mesh_graph + graphadr + 2 + numvert;
edge_localid = m->mesh_graph + graphadr + 2 + 2*numvert;
// init with first vertex in convex hull
ibest = 0;
tmp = local_dir[0] * (mjtNum)vertdata[3*vert_globalid[0]] +
local_dir[1] * (mjtNum)vertdata[3*vert_globalid[0]+1] +
local_dir[2] * (mjtNum)vertdata[3*vert_globalid[0]+2];
// init with first vertex in convex hull or warmstart
ibest = obj->meshindex < 0 ? 0 : obj->meshindex;
tmp = local_dir[0] * (mjtNum)vertdata[3*vert_globalid[ibest]+0] +
local_dir[1] * (mjtNum)vertdata[3*vert_globalid[ibest]+1] +
local_dir[2] * (mjtNum)vertdata[3*vert_globalid[ibest]+2];
// hill-climb until no change
change = 1;