Refactor mj_fullM. This change is part of the deprecation of mjData.qM.

PiperOrigin-RevId: 925669464
Change-Id: I4889c66591bc1df4c31135a13776052aad491f7a
This commit is contained in:
Yuval Tassa
2026-06-02 17:22:15 -07:00
committed by Copybara-Service
parent 49211a05c5
commit 7b9b88060e
15 changed files with 49 additions and 63 deletions
+2 -13
View File
@@ -367,19 +367,8 @@ void mj_setKeyframe(mjModel* m, const mjData* d, int k) {
//-------------------------- inertia functions -----------------------------------------------------
// convert sparse inertia matrix M into full matrix
void mj_fullM(const mjModel* m, mjtNum* dst, const mjtNum* M) {
int adr = 0, nv = m->nv;
mju_zero(dst, nv*nv);
for (int i=0; i < nv; i++) {
int j = i;
while (j >= 0) {
dst[i*nv+j] = M[adr];
dst[j*nv+i] = M[adr];
j = m->dof_parentid[j];
adr++;
}
}
void mj_fullM(const mjModel* m, const mjData* d, mjtNum* dst) {
mju_sym2dense(dst, d->M, m->nv, m->M_rownnz, m->M_rowadr, m->M_colind);
}