W3C home > Mailing lists > Public > www-svg@w3.org > February 2015

Re: Numerical Limits in SVG coordinates?

From: Rik Cabanier <cabanier@gmail.com>
Date: Mon, 2 Feb 2015 21:25:17 -0800
Message-ID: <CAGN7qDCDAkCCryuEJgDaXfj7P010cmqr45SxLZ8sBfeJHwVLdQ@mail.gmail.com>
To: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Cc: www-svg <www-svg@w3.org>
On Mon, Feb 2, 2015 at 5:41 PM, Amelia Bellamy-Royds <
amelia.bellamy.royds@gmail.com> wrote:

> Ooops!  That's what I get for whipping up an answer without actually
> testing anything...  Thanks for checking Rik.
>
> I didn't look closely to see how small the deltas were compared to the
> magnitude in the shape coordinates.   I looked at the viewBox, and thought
> the overall coordinate system dimensions to absolute value was still
> reasonable enough that the lower-precision digits wouldn't be significant.
> I didn't factor in the transform on the shape.
>

There's actually enough of a delta that it should still display.
I suspect that the problem is somewhere in the logic that deals with the
viewbox.


> For Thomas, this clearly wasn't the answer you wanted to hear, but a
> normalization process is definitely going to be necessary.  You'll need to
> figure out a way to store the information about that conversion process
> (and the original coordinates) in metadata, and access it when necessary to
> align multiple drawings.
>

This issue was also noticed by the engineers at KDDI who were using SVG to
draw maps. When they didn't normalize the paths and expressed them in
"world" coordinates, graphics were drawn with low precision.

FWIW in PDF we work around this issue by emitting a translate to the first
coordinate of a path. Then the path coordinates become smaller and the
shape is high precision.


> On 2 February 2015 at 18:12, Rik Cabanier <cabanier@gmail.com> wrote:
>>
>>
>> Actually not :-)
>> Single precision floats have 6 to 9 digits of precision [1] depending how
>> you convert, so Thomas' example might be losing details even on conforming
>> readers.
>> I saved his example to a fiddle and only IE is able to display it:
>> http://jsfiddle.net/d31nv0sy/1/
>> Chrome, Safari and Firefox all show a blank page.
>>
>>
>
Received on Tuesday, 3 February 2015 05:25:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:39 UTC