Skip to content

Commit baf8426

Browse files
thowellcopybara-github
authored andcommitted
Improve wrap_circle.
PiperOrigin-RevId: 756704385 Change-Id: Id44ba317c6072790763a958f4227a76278d3ab74
1 parent ad80a46 commit baf8426

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/engine/engine_util_misc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ static mjtNum wrap_circle(mjtNum pnt[4], const mjtNum end[4], const mjtNum* side
107107
return -1;
108108
}
109109

110+
mjtNum sqrt0 = mju_sqrt(sqlen0 - sqrad);
111+
mjtNum sqrt1 = mju_sqrt(sqlen1 - sqrad);
112+
110113
// construct the two solutions, compute goodness
111114
mjtNum sol[2][2][2], good[2];
112115
for (int i=0; i < 2; i++) {
113-
mjtNum sqrt0 = mju_sqrt(sqlen0 - sqrad);
114-
mjtNum sqrt1 = mju_sqrt(sqlen1 - sqrad);
115-
116116
int sgn = (i == 0 ? 1 : -1);
117117

118118
sol[i][0][0] = (end[0]*sqrad + sgn*radius*end[1]*sqrt0)/sqlen0;

0 commit comments

Comments
 (0)