Avoid unnecessary copies after of mju_mulQuat.

Since fdbbc8bbe0, mju_mulQuat allows in-place computations.
There were a few places where the result was unnecessarily assigned to a temporary variable.

PiperOrigin-RevId: 477746005
Change-Id: I7351ef4796e7d70a4a54b930037bfaadee781f12
This commit is contained in:
Nimrod Gileadi
2022-09-29 09:33:12 -07:00
committed by Copybara-Service
parent 48f2ed99a5
commit 8a8305d3ca
5 changed files with 11 additions and 15 deletions
+2 -3
View File
@@ -35,7 +35,7 @@
// forward kinematics
void mj_kinematics(const mjModel* m, mjData* d) {
mjtNum pos[3], quat[4], *bodypos, *bodyquat;
mjtNum qloc[4], qtmp[4], vec[3], vec1[3], xanchor[3], xaxis[3];
mjtNum qloc[4], vec[3], vec1[3], xanchor[3], xaxis[3];
// set world position and orientation
mju_zero3(d->xpos);
@@ -124,8 +124,7 @@ void mj_kinematics(const mjModel* m, mjData* d) {
}
// apply rotation
mju_mulQuat(qtmp, quat, qloc);
mju_copy4(quat, qtmp);
mju_mulQuat(quat, quat, qloc);
// correct for off-center rotation
mju_sub3(vec, xanchor, pos);