From: Tavmjong Bah <tavmjong@fr...>  20090901 06:39:57

On Tue, 20090901 at 10:39 +1000, Peter Moulder wrote: > On Sun, Aug 30, 2009 at 03:20:44PM +0200, Tavmjong Bah wrote: > > > > ... https://bugs.launchpad.net/inkscape/+bug/382313 ... > > > More specifically, Geom::Matrix.inverse() returns an incorrect > > > matrix. > > > > 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(). > > njh thinks that EPSILON shouldn't be smaller than 1e8 with the current code > & callers. > > Sorry for not checking myself (I'm just about to leave), but is changing > EPSILON to 1.5e8 enough to make this test case work? The inverse() function is used to find the bounding box of the image in drawing coordinates. Setting EPSILON to 1.5e8 would make this test case work but would cause trouble if anybody wanted to use the feImage filter with an image greater than 8000x8000 px (not common... but you never know). (There is the question of why a matrix inversion is necessary in the first place to find the bounding box but that is a separate issue for a filters expert.) Fundamentally, I think having one value of EPSILON used everywhere in lib2geom is wrong as the way it is used is different in different functions. Not knowing much about lib2geom, I would guess that using EPISLON^2 in the matrix inverse function would be more reasonable. Tav 