[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #8824] added affine2d class
From: |
Avinoam Kalma |
Subject: |
[Octave-patch-tracker] [patch #8824] added affine2d class |
Date: |
Sun, 21 May 2017 11:42:39 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 |
Follow-up Comment #8, patch #8824 (project octave):
Consider the following script:
isTranslation(affine2d ([1 0 0; 0 -1 0; 0 0 1]))
isRigid(affine2d ([1 0 0; 0 -1 0; 0 0 1]))
isSimilarity(affine2d ([1 2 0; 3 4 0; 0 0 1]))
a = invert(affine2d ([1 2 0; 3 4 0; 10 20 1]))
b = affine2d(a.T)
The first 3 command give 1, which is wrong.
The last command fails with an error.
The reasons are:
isTranslation: the check is
check = all ((abs (abs (submatrix) - eye (this.Dimensionality)) < e^-10)(:));
which is wrong - the 2nd abs should be removed. It should be
check = all ((abs(submatrix - eye (this.Dimensionality)) < e^-10)(:));
Since I do not like those e^-10, I would prefer
check = all (abs (submatrix - eye (this.Dimensionality)) < eps)(:));
or even
check = !any (abs (submatrix - eye (this.Dimensionality)) > 0)(:));
Explanation: submatrix should be the Identity matrix (in the accuracy limits),
so maybe the check should be different for
the diagonal entries (which should be 1), and the non-diagonal
(which should be 0)
isRigid: The submatrix should be a rotation matrix, without
scale or shear, so its determinant should be 1:
check = abs ((det (submatrix)) -1) < eps;
isSimilarity: The submatrix should be a rotation matrix multiplied by
constant, so the condition is something like
s2 = submatrix*submatrix';
ans = all((abs(s2 - s2(1,1)*eye(2)) < ones(2)*eps)(:));
s2 should be the Identity Matrix multiplied by a constant.
When I do
a = invert(affine2d ([1 2 0; 3 4 0; 10 20 1]))
a.T(3,3)-1 = -1.1102e-016
so a.T(3,3) is not 1, and b = affine2d(a.T) fails.
there should be something like
this.T(:,3) = [0; 0; 1];
BTW, line 72 should be:
this.T = inv (this.T);
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?8824>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/