1 Sep
2009
1 Sep
'09
4:58 p.m.
Jasper van de Gronde wrote:
- Use range arithmetic. If you using different rounding modes for the determinant can get you numbers in a range that straddles zero I'd say it's fair to say the matrix is essentially singular.
This is not going to work, because a small determinant will always round to 0 regardless of the rounding mode. Rounding modes only affect what is done to halfway cases like 0.5 when nearbyint() is called; it doesn't affect round() or trunc().
- If changing rounding modes is too problematic, we could always do a poor man's version of range arithmetic using nextafter/nexttoward.
Won't work for the same reason as above; rounding has little to do with this issue.
- We compute 1.0/det. If det is so small that this (or the value in the resulting matrix with the largest magnitude) is inf(inite) there wouldn't be much sense in computing the inverse, as we can't represent it.
I think this is the correct way to fix this (and of course review the way EPSILON is used). We could use some more unit tests (right now I don't even know how to run the existing ones...)
Regards, Krzysztof
--
View this message in context: http://www.nabble.com/Broken-feImage-and-lib2geom-matrix-inversion-tp2521063...
Sent from the Inkscape - Dev mailing list archive at Nabble.com.