Hi,
I'm trying to use <path> elements generated by Inkscape in my game. I have a small problem with the coordinates being somehow out of whack when saved. While editing I have a point that has the coordinates 996.823, 952.690 in Inkscape. The decimals are irrelevant. This I see in the X and Y edit boxes at the top. When I save my file to SVG the same point ends up being:
d="M 996.823,1047.31 ..."
It's the first point of the path. The X coordinate is fine but all Y coordinates are always offset by something like 50 units for all points I've checked. What could cause this offset? The saved file contains no transforms, no matrices and no coordinate offsets that I can find. All the points are saved as absolute (through the SVG output option). I thought that perhaps the layer would be offset vertically, but I can't find anything looking like that:
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
style="display:inline">
<path ...
....
</g>
Any hints? I can not use Inkscape if I can't get the coordinates to be correct. I'd hate to have to write a simple path editor just for this silly game experiment.
Coordinates of points in paths
Re: Coordinates of points in paths
Um, are the coordinates flipped vertically? The height of my canvas is 2000 and 2000 - 1047.31 == 952.69. So SVG uses top left as 0,0 and Inkscape uses bottom left as 0,0. Doesn't exactly make sense, but at least I know what happens now.
Re: Coordinates of points in paths
While editing I have a point that has the coordinates 996.823, 952.690 in Inkscape. The decimals are irrelevant. This I see in the X and Y edit boxes at the top.
I don't understand exactly what you mean, because those boxes don't give you coordinates of points, but of objects.
Last edited by druban on Sun Mar 04, 2012 11:59 pm, edited 1 time in total.
Your mind is what you think it is.
Re: Coordinates of points in paths
Inkscape uses two coordinate systems: one for GUI and one in the SVG source (as defined in the SVG 1.1 specification). The conversion between the two coordinate systems is handled inernally and done on-the-fly):
- Inkscape's GUI uses the first quadrant of the normal Cartesian coordinate system, with the origin in the lower left corner of the page and the y-axis pointing upwards.
(This originates in Inkscape's predecessor application (SodiPodi), based on how other vector-based drawing applications work as well as most CAD software). - The SVG coordinate system in the SVG source (as defined in the SVG 1.1 specification) uses the 4th quadrant of the normal Cartesian coordinate system (or also referred to as 'left-handed' system), with the origin located in the upper left corner of the page and the y-axis pointing downwards.