- From: Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
- Date: Sun, 04 Jan 2015 20:23:56 +0100
- To: www-svg@w3.org
On 2015-01-03 00:02, ryan.richards@ani-mayhem.com wrote: > In most SVG implementations certain seed values cause voids in the output > of feTurbulence as the result of a bug in the reference code. The first > seed that does this is 514. There are many more. ... > With this initial seed number, lSeed = random(lSeed) will eventually yield > a pair of numbers where (lseed % (BSize + BSize) - BSize) / BSize = 0 > being added to fGradient ([k][i][0] and [k][i][1] in the code). Having a 0 > is not a problem as long as the other number is not 0, there is an > addition operation so the result is more than 0. However, when both > numbers are 0 in the next step there is division by 0. That's a problem. > The solution is to check if [k][i][0] and [k][i][0] are BOTH 0, and if > they are, make them both not 0 by some method. I suggested making both 1 > in my bug reports to Batik and Inkscape. Or ask Opera what method they > used for the older version of their browser as it is not affected. I would not recommend setting both components to 1, as this could in principle introduce bias. The commonly accepted solution to this type of problem is to use rejection sampling. That is, just try again if you get two zeros. This would not change anything for seeds that happen not to give rise to zero vectors, and would let the algorithm work as intended for other seeds.
Received on Sunday, 4 January 2015 19:24:28 UTC