Skip to content

Commit 7d5b360

Browse files
yuvaltassacopybara-github
authored andcommitted
Add clarifying comments to mju_transformSpatial
PiperOrigin-RevId: 782842640 Change-Id: I1e6fc27a860b4afc3a00ab4be6d5cb2897b4426b
1 parent 11e695b commit 7d5b360

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/engine/engine_util_spatial.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,10 @@ void mju_mulDofVec(mjtNum* res, const mjtNum* dof, const mjtNum* vec, int n) {
491491

492492

493493
// transform 6D motion or force vector between frames
494-
// rot is 3-by-3 matrix; flg_force determines vector type (motion or force)
494+
// flg_force: determines vector type (motion or force)
495+
// rotnew2old: rotation that maps vectors from new to old frame,
496+
// its columns are the new frame's axes, expressed in the old frame
497+
// oldpos and newpos are expressed in old frame
495498
void mju_transformSpatial(mjtNum res[6], const mjtNum vec[6], int flg_force,
496499
const mjtNum newpos[3], const mjtNum oldpos[3],
497500
const mjtNum rotnew2old[9]) {
@@ -508,7 +511,7 @@ void mju_transformSpatial(mjtNum res[6], const mjtNum vec[6], int flg_force,
508511
mju_sub3(tran+3, vec+3, cros);
509512
}
510513

511-
// apply rotation if provided
514+
// if provided, apply old -> new rotation
512515
if (rotnew2old) {
513516
mju_mulMatTVec3(res, rotnew2old, tran);
514517
mju_mulMatTVec3(res+3, rotnew2old, tran+3);

0 commit comments

Comments
 (0)