I created a path approximately centered about (0, 0) extending from -0.5 to 0.5 on both the x and y axes, but when I look at the SVG, the numbers are not what I expect. I set up the units in inkscape to be in meters.
So how do I set up Inkscape such that when I exactly position a point on a path, the values are accurate in the SVG code?
The transofrmation I got in this case was that +0.5 went to about 1771, -0.5 went to about 0 - is there any way to reverse this?
Thanks,
J
getting accurate coordinates/units in SVG code
Re: getting accurate coordinates/units in SVG code
The units used in the SVG file are always 'px' - independent of the units you choose as default (in document preferences). AFAIK this conversion (and any resulting precision issues and rounding errors) cannot be avoided or changed with a preference setting.PeskyJ wrote:I set up the units in inkscape to be in meters.
If you need accurate numbers, stay with 'px' as default values (and use pixel-grid-aligned page sizes). But even then the conversion of the coordinate system from <origin at bottom left corner, first quadrant> (Inkscape canvas) to <origin at top left, fourth quadrant> (SVG file) recalculates all coordinates and can result in different numbers and rounding errors, at least for y-values.
it is automatically 'reversed' on-the-fly when rendering the svg elements on canvas, but in the file Inkscape still uses 'px' and the 'forth quadrant' coordinate system.PeskyJ wrote:is there any way to reverse this?
I'm not very good explaining this - if I find a better reference on the net I'll add a link here ;-)
hth, ~suv
Re: getting accurate coordinates/units in SVG code
Thanks, this is useful. I find pixels a somewhat nonsensical unit for vector data as it really depends on your viewing scale. I found an easier solution than attempting to control the units to known values, instead I calculate the bounds and determine a scale and offset from that to apply before my actual desired transformations.