Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
added first tests (partially addresses Needs a test suite #4). I skipped some primitive functions, though, in best practice, every function should be tested - I hope others will contribute!
added CircleCI suite for your repository that will be automatically run on each commit. All you need to do is
In order to show the badge, I renamed README to README.md
fixed a bug in
mat4x4o_mul_quat
: the last element in each row of the resulting matrix was not set. Previously, there was junk data.Reused
vec4
code forquat
:Previously, only
#define quat_norm vec4_norm
was set.Normalize
axis
to a unit norm inquat_rotate
. An alternative implementation, when the user has to deal with normalization manually, isThe previous version was strange and not optimized. Let me know which one you prefer - force users to manually normalize
axis
(the snippet above, optimized) or take care of the normalization in the function body (current).added
vec##n##_dup
function (used it inmat4x4_dup
andmat4x4_scale_aniso
functions, and several times in linmath_test.h). Previously, there was only amat4x4_dup
function. Also, now we can get rid of unsafe memcpy, which is the only function that requires<string.h>
to be imported. Let me know if it's better to reusevec##n##_dup
instead ofmemcpy
(the fix if very easy to add).(minor) added const qualifiers to each function (hints). Previously, there were several functions with a const qualifier and most of them didn't have any. We should either put const every time when the argument is not modified or don't use const at all. On second thought, I'm not sure how much it makes sense - for me, the tradeoff of const versus not const has never been clear.
There is a bunch of things. Let me know if you want to include only a part of them.
Danylo
Update 1
I noticed that linmath.h sometimes is used as a submodule to build a C/C++ project. Adding linmath_test.c with a main() function will break such workflows. Does it make sense generating linmath_test.c on the fly at CircleCI runs?
Update 2
I noticed that
quat_inner_product
was used to compute the inner product of two quaternions. Now I redefined it as#define quat_mul_inner vec4_mul_inner
. Doing so introduces a breaking change for other projects that use linmath. Let me know if I should rename it to#define quat_inner_product vec4_mul_inner
.