Understanding transforms

Discuss SVG code, accessible via the XML Editor.
sliptonic
Posts: 1
Joined: Wed Mar 13, 2013 12:56 am

Understanding transforms

Postby sliptonic » Wed Mar 13, 2013 1:05 am

I'm a very casual inkscape user so forgive my ignorance.

I've created a document and set the default units to mm and the size to 200x200 mm

The document contains several hundred circle elements which will be drilling locations for a CNC drilled stipple image. After saving the document as an optimzed SVG, the XML looks like this:
<circle id="circle19865" transform="matrix(1.9283 0 0 1.7372 -1047.3 -744.68)" cy="306.66" cx="1680.6" r="1.0378"/>

I would expect the cx and xy values for each circle to be between 0 and 200 but they're not. I'm assuming inkscape is storing an offset in the transformation. Is there a way to apply the transformation absolutely? If not, where do I go to understand the transformation matrix so I can calculate the coordinates in code?

Thanks much.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Understanding transforms

Postby druban » Thu Mar 14, 2013 6:27 am

Transform matrix in Inkscape manual

I repeat T. BAh's warning here that Inkscape's internal coordinate system sets the top left corner of the page as the origin, not the bottom left (as is shown on screen) or the center as you might imagine. Just a heads up. I believe it might have something to do with the svg standard. Quite confusing at first, and well, even later :D .

Off topic:
My usual approach is to get rid of the matrix entirely because I am not sending data to another machine as it sounds like you are doing. To do this I ungroup everything and convert all special shapes to paths (object menu, path menu). I then select all and use the arrow keys to move everything one nudge up and then one nudge back down. This results in all paths beng rewritten without a matrix but unfortunately the circle will no longer be a circle with a center and radius but a 4-node bezier approximation of a circular path. This probably is not what you want.
Your mind is what you think it is.

User avatar
flamingolady
Posts: 687
Joined: Wed Jun 10, 2009 1:40 pm

Re: Understanding transforms

Postby flamingolady » Fri Mar 15, 2013 5:36 am

This appears to be a bit over my head, but, I might have an idea. Do any of your objects/circles have a stroke on them? Because the stroke with change widths automatically. If you don't need the stroke, you can set it as zero. Or, if you are using it, make sure your zoom is on 100%, then set the stroke accordingly. Just a thought as I remember something Brynn once said that changes the values.


Return to “SVG / XML Code”