transform : don't use matrix but skewY, scale...

Post questions on how to use or achieve an effect in Inkscape.
v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

transform : don't use matrix but skewY, scale...

Postby v1nce » Wed May 09, 2012 1:44 am

Hi,

Is there a way to stop inkscape turning every transform operation into a matrix ?

transform="skewY(20)" is far more readable than transform="matrix 1 0 0.342 0.940 0 0"

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: transform : don't use matrix but skewY, scale...

Postby ~suv » Wed May 09, 2012 2:24 am

v1nce wrote:Is there a way to stop inkscape turning every transform operation into a matrix ?

No, Inkscape does not offer such an option.

(and yes, related feature requests have already been filed in the bug tracker)

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: transform : don't use matrix but skewY, scale...

Postby chriswww » Wed May 09, 2012 9:00 am

it's not a matter of stopping inkscape turning manipulations into transform matrix. Rather it is that inkscape presents in the GUI particular matrix transformations as particular operations, e.g. skewY. SVG format does not have a skew operation per se, it has a (full) transformation matrix instead, with which you can achieve things such as skew or scale or rotate etc. Adding each individual as a separate operation would be a duplication of what a transformation matrix can do, and the matrix can combine the scale, skew, rotate etc in one operation. From my rusty high school maths I remember that we called a particular matrix transformation as a scale or skew or rotate but, there was nothing in the notation to indicate such. So I guess that's the root of that evil ;)
you can easily detect by eye or by script that a particular transform is a skew by checking the particular number that indicates a "skew" transformation.
if any of this is wrong, i take it all back ;)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: transform : don't use matrix but skewY, scale...

Postby ~suv » Wed May 09, 2012 10:39 am

chriswww wrote:SVG format does not have a skew operation per se, it has a (full) transformation matrix instead (…)

Hmm, what makes you think so?

SVG 1.1 > 7.6 The ‘transform’ attribute wrote:The value of the ‘transform’ attribute is a <transform-list>, which is defined as a list of transform definitions, which are applied in the order provided. The individual transform definitions are separated by whitespace and/or a comma. The available types of transform definitions include:
  • matrix(<a> <b> <c> <d> <e> <f>), which specifies a transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f].
  • translate(<tx> [<ty>]), which specifies a translation by tx and ty. If <ty> is not provided, it is assumed to be zero.
  • scale(<sx> [<sy>]), which specifies a scale operation by sx and sy. If <sy> is not provided, it is assumed to be equal to <sx>.
  • rotate(<rotate-angle> [<cx> <cy>]), which specifies a rotation by <rotate-angle> degrees about a given point.
    If optional parameters <cx> and <cy> are not supplied, the rotate is about the origin of the current user coordinate system. The operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0].
    If optional parameters <cx> and <cy> are supplied, the rotate is about the point (cx, cy). The operation represents the equivalent of the following specification: translate(<cx>, <cy>) rotate(<rotate-angle>) translate(-<cx>, -<cy>).
  • skewX(<skew-angle>), which specifies a skew transformation along the x-axis.
  • skewY(<skew-angle>), which specifies a skew transformation along the y-axis.

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: transform : don't use matrix but skewY, scale...

Postby chriswww » Thu May 10, 2012 1:13 pm

by golly you're right. i take it all back. i thought i remembered the 1.0 spec (roughly)...looks like not.
in which case..the transformation matrix for x axis skew translates to [1 0 tan(a) 1 0 0] and y axis skew is [1 tan(a) 0 1 0 0]
strangely enough the matrix you see when you click edit current matrix (when doing say a single x axis skew) both C and D change in the matrix [A B C D E F]
and if you tweak C or D individually directly in the matrix, all you get is simple translations. Does that mean the matrix includes the viewport as well?
most strange machinations.
But apart from these crazy numbers, I can appreciate why it would be done as a matrix instead of a skew, and that is that you can combine both the skew operations plus any other transformations on the object at any point in time, in the single matrix that takes care of all types of transformations and cumulatively. And in fact that is how it pans out, so to speak. You can do multiple transformations of different kinds to an object, and it yields a simple single one transform operation and associated matrix.
sorry about the bum steer before...i should check reference more often :oops:


Return to “Help with using Inkscape”