Skip to content

Commit

Permalink
Fix quat_fromEuler
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejiangzhi committed Nov 22, 2023
1 parent e078b10 commit 4958da7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/maf.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,18 @@ MAF void quat_toEuler(quat q, float* x, float* y, float *z) {
}

MAF quat quat_fromEuler(quat q, float x, float y, float z) {
double cy = cos(z * 0.5);
double sy = sin(z * 0.5);
double cp = cos(y * 0.5);
double sp = sin(y * 0.5);
double cr = cos(x * 0.5);
double sr = sin(x * 0.5);
double cx = cos(x * 0.5);
double sx = sin(x * 0.5);
double cy = cos(y * 0.5);
double sy = sin(y * 0.5);
double cz = cos(z * 0.5);
double sz = sin(z * 0.5);

return quat_set(q,
cy * sr * cp - sy * cr * sp,
cy * cr * sp + sy * sr * cp,
sy * cr * cp - cy * sr * sp,
cy * cr * cp + sy * sr * sp
cy * sx * cz + sy * cx * sz,
sy * cx * cz - cy * sx * sz,
cy * cx * sz - sy * sx * cz,
cy * cx * cz + sy * sx * sz
);
}

Expand Down

0 comments on commit 4958da7

Please sign in to comment.