Re: [Inkscape-devel] [Lib2geom-devel] FW: Broken feImage and lib2geommatrix inversion
Looking at the code, it seems that it used to be possible to specify the "numerical tolerance". Shall we put this back in?
-----Original Message----- From: J.B.C.Engelen@...1578... [mailto:J.B.C.Engelen@...1578...] Sent: maandag 31 augustus 2009 9:57 To: lib2geom-devel@lists.sourceforge.net Cc: tavmjong@...8... Subject: [Lib2geom-devel] FW: [Inkscape-devel] Broken feImage and lib2geommatrix inversion
Hi guys,
See the email below.
-----Original Message----- From: Tavmjong Bah [mailto:tavmjong@...8...] Sent: Sunday, August 30, 2009 13:10 To: Inkscape Devel List Subject: [Inkscape-devel] Broken feImage and lib2geom
matrix inversion
Hi,
I've traced the problem with the broken feImage filter
primitive (see
https://bugs.launchpad.net/inkscape/+bug/382313 ) to a problem with lib2geom. More specifically, Geom::Matrix.inverse() returns an incorrect matrix. I run
this simple
test program:
#include <iostream> #include <2geom/matrix.h>
int main() {
Geom::Matrix test_matrix1( 0.003333, 0.000000, 0.000000,
0.003333,
0.083333, 0.083333 );
Geom::Matrix test_inverse1 = test_matrix1.inverse();
std::cout << "Test input" << std::endl; std::cout << test_matrix1 << std::endl;
std::cout << "Test output" << std::endl; std::cout << test_inverse1 << std::endl;
Geom::Matrix test_matrix2( 0.003077, 0.000000, 0.000000,
0.003077,
0.076923, 0.076923 );
Geom::Matrix test_inverse2 = test_matrix2.inverse();
std::cout << "Test input" << std::endl; std::cout << test_matrix2 << std::endl;
std::cout << "Test output" << std::endl; std::cout << test_inverse2 << std::endl; }
The output I see is:
Test input A: 0.003333 C: 0 E: 0.083333 B: 0 D: 0.003333 F: 0.083333
Test output A: 300.03 C: -0 E: -25.0024 B: -0 D: 300.03 F: -25.0024
Test input A: 0.003077 C: 0 E: 0.076923 B: 0 D: 0.003077 F: 0.076923
Test output A: 1 C: 0 E: 0 B: 0 D: 1 F: 0
You can see that the first matrix inversion is correct but
the second
is wrong. This was tested with SVN as of yesterday on Linux.
A bit more info.
In Geom::Matrix::inverse() the matrix determinate is calculated and then compared to the constant EPSILON which is defined as 10^-5 (in coord.h). If it is less than EPSILON the matrix is set to unity. This
EPSILON is
clearly way too large for use in inverse(). For some reason
a value of
10^-18 in commented out in coord.h. My guess is that the
value 10^-5
was selected for comparing pixel positions to each other but it is being used for other purposes in the lib2geom library.
Tav
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Lib2geom-devel mailing list Lib2geom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lib2geom-devel
participants (1)
-
unknown@example.com