Skip to content
Browse files

Switched s to be real in from_matrix.

  • Loading branch information...
1 parent 3f3f463 commit 5fcbb8350ec63071173dadb47005a82f487f4668 @ColdenCullen ColdenCullen committed May 5, 2014
Showing with 4 additions and 4 deletions.
  1. +4 −4 gl3n/linalg.d
View
8 gl3n/linalg.d
@@ -2052,28 +2052,28 @@ struct Quaternion(type) {
qt trace = mat[0][0] + mat[1][1] + mat[2][2];
if(trace > 0) {
- qt s = 0.5 / sqrt(trace + 1.0f);
+ real s = 0.5 / sqrt(trace + 1.0f);
ret.w = to!qt(0.25 / s);
ret.x = to!qt((mat[2][1] - mat[1][2]) * s);
ret.y = to!qt((mat[0][2] - mat[2][0]) * s);
ret.z = to!qt((mat[1][0] - mat[0][1]) * s);
} else if((mat[0][0] > mat[1][1]) && (mat[0][0] > mat[2][2])) {
- qt s = 2.0 * sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]);
+ real s = 2.0 * sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]);
ret.w = to!qt((mat[2][1] - mat[1][2]) / s);
ret.x = to!qt(0.25f * s);
ret.y = to!qt((mat[0][1] + mat[1][0]) / s);
ret.z = to!qt((mat[0][2] + mat[2][0]) / s);
} else if(mat[1][1] > mat[2][2]) {
- qt s = 2.0 * sqrt(1 + mat[1][1] - mat[0][0] - mat[2][2]);
+ real s = 2.0 * sqrt(1 + mat[1][1] - mat[0][0] - mat[2][2]);
ret.w = to!qt((mat[0][2] - mat[2][0]) / s);
ret.x = to!qt((mat[0][1] + mat[1][0]) / s);
ret.y = to!qt(0.25f * s);
ret.z = to!qt((mat[1][2] + mat[2][1]) / s);
} else {
- qt s = 2.0 * sqrt(1 + mat[2][2] - mat[0][0] - mat[1][1]);
+ real s = 2.0 * sqrt(1 + mat[2][2] - mat[0][0] - mat[1][1]);
ret.w = to!qt((mat[1][0] - mat[0][1]) / s);
ret.x = to!qt((mat[0][2] + mat[2][0]) / s);

0 comments on commit 5fcbb83

Please sign in to comment.
Something went wrong with that request. Please try again.