linmath.h
linmath.h copied to clipboard
a lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions
By default C compiler treats floating point numbers as double, so "1." is always converted to float, "1.f" should be used instead. https://github.com/datenwolf/linmath.h/blob/05387571f57224f8cbc2b390b423dab6b9158988/linmath.h#L582
https://github.com/datenwolf/linmath.h/blob/05387571f57224f8cbc2b390b423dab6b9158988/linmath.h#L599 Usage of acos() function instead of acosf() makes compiler do a float-to-double conversion and back without needs.
Unfortunately, the function doesn't give correct results. Here's a proposal to change it (taken from https://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm): ``` float tr = M[0][0] + M[1][1] + M[2][2]; if (tr > 0) {...
Every function of linmath.h should be complemented by a matching suite of tests. While those can't assure correctness, they can act as a canary toward behavior changes.
So uhh yeah, whenever I try to use linmath, I get 12 warnings all telling me that "Severity Code Description Project File Line Column Suppression State Warning C4244 'initializing': conversion...
These issues were found in Clang static analyzer with -Wconversion. Only two, both very minor.
Take a look at what I did in mat4x4_dup() and mat4x4_identity(). Maybe I should have just modified those and attempted to merge, but there seems to be a lot of...
after commit 05387571f57224f8cbc2b390b423dab6b9158988 redundant #include #include #include #include