Skip to content

Commit

Permalink
fix mat4_axis_angle and quat_to_mat4 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopolimeni authored and felselva committed May 20, 2019
1 parent 4e4e0ee commit d672725
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mathc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2981,8 +2981,8 @@ mfloat_t *mat4_rotation_axis(mfloat_t *result, mfloat_t *v0, mfloat_t f)
mfloat_t s = MSIN(f);
mfloat_t one_c = MFLOAT_C(1.0) - c;
mfloat_t x = v0[0];
mfloat_t y = v0[4];
mfloat_t z = v0[8];
mfloat_t y = v0[1];
mfloat_t z = v0[2];
mfloat_t xx = x * x;
mfloat_t xy = x * y;
mfloat_t xz = x * z;
Expand Down Expand Up @@ -3017,21 +3017,21 @@ mfloat_t *mat4_rotation_quat(mfloat_t *result, mfloat_t *q0)
mfloat_t zz = q0[2] * q0[2];
mfloat_t xy = q0[0] * q0[1];
mfloat_t zw = q0[2] * q0[3];
mfloat_t xz = q0[8] * q0[0];
mfloat_t xz = q0[0] * q0[2];
mfloat_t yw = q0[1] * q0[3];
mfloat_t yz = q0[1] * q0[2];
mfloat_t xw = q0[0] * q0[3];
result[0] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (yy - zz);
result[0] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (yy + zz);
result[1] = MFLOAT_C(2.0) * (xy + zw);
result[2] = MFLOAT_C(2.0) * (xz - yw);
result[3] = MFLOAT_C(0.0);
result[4] = MFLOAT_C(2.0) * (xy - zw);
result[5] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (xx - zz);
result[5] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (xx + zz);
result[6] = MFLOAT_C(2.0) * (yz + xw);
result[7] = MFLOAT_C(0.0);
result[8] = MFLOAT_C(2.0) * (xz + yw);
result[9] = MFLOAT_C(2.0) * (yz - xw);
result[10] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (xx - yy);
result[10] = MFLOAT_C(1.0) - MFLOAT_C(2.0) * (xx + yy);
result[11] = MFLOAT_C(0.0);
result[12] = MFLOAT_C(0.0);
result[13] = MFLOAT_C(0.0);
Expand Down

1 comment on commit d672725

@ArthurFirmino
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI both these bugs are still present in the mat3 versions

Please sign in to comment.