You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok I re-thought the problem with precision. @Ede123 I think your right about the zero being arbitrary related to #136. This is not an attempt to waste your time and sound like I'm repeat myself. Not sure if the scour project is interested in going in this direction. But thought I'd share anyway.
I think the reason that rounding near zero worked well for me was not that 0 is special. Its that the precision operation doesn't account for the dimensions of the svg image viewbox.
If I have a viewbox 100px width 100px height, normally I'm not too concerned with precision like 0.00001. Actually it seems the smallest number i work with is intervals of 0.01. So 100/0.01 = 10000 units. Which looks like 6 significant digits.
Similarly if i have a viewbox 30px by 30px, using the same 10000 units, my smallest signficant interval would be 0.003.
So how does a number like 0.00005 slip by scour, but not 1.00005?
The suggestion is to implement some limiting option like --max-decimal-point, or --precision-relative-to-viewbox, or even implicity limit the max to 10,000/100,000 units the max width/height.
The text was updated successfully, but these errors were encountered:
So how does a number like 0.00005 slip by scour, but not 1.00005?
That's the very reason for using significant digits... If you have a value of 1.00005 dropping the digits is an error of less than 0.005%. If you have a value of 0.00005 and change it to zero the error is infinity.
Now I agree there are situations where this is acceptable as it could be a simple rounding issue. However it's very hard to determine when this would be acceptable. Using the viewBox of the image would work in some cases but completely ignores that objects might be scaled.
Right now I have no good idea how this could be solved in an universal way without breaking some images. The correct approach would probably be to determine the bounding box size of a give object and adjust precision relative to that, but you probably can imagine that this is not an easy task...
Your rounding errors are correct when the number is rounded relative to itself. But relative to the 100px by 100px width/height, dropping the .00005 is an error of 0.00005% for both 1.00005 and 0.00005.
Ok I re-thought the problem with precision. @Ede123 I think your right about the zero being arbitrary related to #136. This is not an attempt to waste your time and sound like I'm repeat myself. Not sure if the scour project is interested in going in this direction. But thought I'd share anyway.
I think the reason that rounding near zero worked well for me was not that 0 is special. Its that the precision operation doesn't account for the dimensions of the svg image viewbox.
If I have a viewbox 100px width 100px height, normally I'm not too concerned with precision like 0.00001. Actually it seems the smallest number i work with is intervals of 0.01. So 100/0.01 = 10000 units. Which looks like 6 significant digits.
Similarly if i have a viewbox 30px by 30px, using the same 10000 units, my smallest signficant interval would be 0.003.
So how does a number like 0.00005 slip by scour, but not 1.00005?
The suggestion is to implement some limiting option like --max-decimal-point, or --precision-relative-to-viewbox, or even implicity limit the max to 10,000/100,000 units the max width/height.
The text was updated successfully, but these errors were encountered: