summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-10-24 12:36:22 -0400
committerTavian Barnes <tavianator@gmail.com>2010-10-24 12:36:22 -0400
commit1fba91c6fe9115be67929ce1e247dd759a21fcd1 (patch)
treea4bffa0d10c36b6d14f285c1f198dc5d0d6297e5 /libdimension
parent53e9dedf5e9caacd1ef7a9f44da4d2218ba23cb2 (diff)
downloaddimension-1fba91c6fe9115be67929ce1e247dd759a21fcd1.tar.xz
Be more conservative about when to invert by partitioning.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/geometry.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libdimension/geometry.c b/libdimension/geometry.c
index 2a16313..6d3652f 100644
--- a/libdimension/geometry.c
+++ b/libdimension/geometry.c
@@ -61,7 +61,7 @@ dmnsn_rotation_matrix(dmnsn_vector theta)
if (angle == 0.0) {
return dmnsn_identity_matrix();
}
- dmnsn_vector axis = dmnsn_vector_normalize(theta);
+ dmnsn_vector axis = dmnsn_vector_div(theta, angle);
/* Shorthand to make dmnsn_new_matrix() call legible */
@@ -142,8 +142,8 @@ dmnsn_matrix_inverse(dmnsn_matrix A)
dmnsn_matrix2 P, Q, R, S, Pi, RPi, PiQ, RPiQ, PP, QQ, RR, SS;
double Pdet = A.n[0][0]*A.n[1][1] - A.n[0][1]*A.n[1][0];
- if (Pdet == 0.0) {
- /* If we can't invert P, try a more generic algorithm; this is very
+ if (fabs(Pdet) < dmnsn_epsilon) {
+ /* If P is close to singular, try a more generic algorithm; this is very
* unlikely, but not impossible, eg.
* [ 1 1 0 0 ]
* [ 1 1 1 0 ]