aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Transfo.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/Transfo.c b/generic/Transfo.c
index a45b701..6c1c408 100644
--- a/generic/Transfo.c
+++ b/generic/Transfo.c
@@ -395,8 +395,14 @@ ZnTransfoDecompose(ZnTransfo *t,
local._[1][1] -= local._[0][1]*shear;
len = sqrt(local._[1][0]*local._[1][0] +
local._[1][1]*local._[1][1]); /* Get y scale from 2nd row */
- if (scale)
+ if (scale) {
scale->y = len < PRECISION_LIMIT ? 0.0 : len;
+ }
+
+ if (!shearxy && !rotation) {
+ return;
+ }
+
local._[1][0] /= len; /* Normalize 2nd row */
local._[1][1] /= len;
shear /= len;
@@ -404,6 +410,11 @@ ZnTransfoDecompose(ZnTransfo *t,
*shearxy = ABS(shear) < PRECISION_LIMIT ? 0.0 : shear;
//printf("shear %f\n", *shearxy);
}
+
+ if (!rotation) {
+ return;
+ }
+
//printf("Matrix after scale & shear extracted\n");
//ZnPrintTransfo(&local);
/* Get rotation */