aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordatenwolf <code+github@datenwolf.net>2019-04-16 11:42:17 +0200
committerGitHub <noreply@github.com>2019-04-16 11:42:17 +0200
commit22d1adc070c903d25ac9ff5614e63722b2d575e6 (patch)
tree1ce26bd0895048efcca8f6e1a43e0ca68f3b4a1d
parent4af990a5e6dd8eb45426d1af6e25899adbf96d79 (diff)
parent06449fb862afea9092e33adfda416d5b677ad05a (diff)
downloadlinmath.h-22d1adc070c903d25ac9ff5614e63722b2d575e6.tar.gz
linmath.h-22d1adc070c903d25ac9ff5614e63722b2d575e6.tar.bz2
Merge pull request #32 from nwn/master
Fix bug in mat4x4_orthonormalize
-rw-r--r--linmath.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/linmath.h b/linmath.h
index de9bae8..96725e8 100644
--- a/linmath.h
+++ b/linmath.h
@@ -321,12 +321,11 @@ LINMATH_H_FUNC void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
s = vec3_mul_inner(R[1], R[2]);
vec3_scale(h, R[2], s);
vec3_sub(R[1], R[1], h);
- vec3_norm(R[2], R[2]);
+ vec3_norm(R[1], R[1]);
- s = vec3_mul_inner(R[1], R[2]);
+ s = vec3_mul_inner(R[0], R[2]);
vec3_scale(h, R[2], s);
- vec3_sub(R[1], R[1], h);
- vec3_norm(R[1], R[1]);
+ vec3_sub(R[0], R[0], h);
s = vec3_mul_inner(R[0], R[1]);
vec3_scale(h, R[1], s);