aboutsummaryrefslogtreecommitdiff
path: root/generic/Transfo.c
diff options
context:
space:
mode:
authorlecoanet2002-12-20 13:48:47 +0000
committerlecoanet2002-12-20 13:48:47 +0000
commita44d24a9896a3290c4a3ecd1ff2aa0ea629d41a9 (patch)
tree6ed807ab6a9298f0e21a4d0766c9bda58b7fae02 /generic/Transfo.c
parentba4ca99e92622f248d4babbf4cfa0fedbb6974fb (diff)
downloadtkzinc-a44d24a9896a3290c4a3ecd1ff2aa0ea629d41a9.zip
tkzinc-a44d24a9896a3290c4a3ecd1ff2aa0ea629d41a9.tar.gz
tkzinc-a44d24a9896a3290c4a3ecd1ff2aa0ea629d41a9.tar.bz2
tkzinc-a44d24a9896a3290c4a3ecd1ff2aa0ea629d41a9.tar.xz
Petite optimisation de la fonction de d�composition des transfos.
Diffstat (limited to 'generic/Transfo.c')
-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 */