1

Why there is a translation possibility for use when i can move shapes around with x y attributes and vice versa? Is it just redundant or are there special situations where one is preferred over the other method?

2

It is a inheritance issue. When programmers model nodes they lump similar functions together, and everything that has certain properties inherit all the other properties. Things evolve and get added, most of the time not removed.

You dont actually ever need x and y for anything if translate is available, however modeling architecture designers (mostly programmers) can also not remove things because somebody may be already be using the feature. Besides x and y conceptually simpler and the backend needs to be implemented anyway so why not include it. In any case x and y is not the same thing as translate.

Translate describes a matrix while x and y describe 2 scalars or a 2D vector. So translate has 8 degrees of freedom while x and y each have one for a total of 2. Translate can scale skew and rotate the image in addition to translate.

PS: SVG is arguably not a very good format, but design by committee has that effect. Mainly because SVG relies on bits and pieces that are not xml for many things so you end up needing to understand 3 separate modeling paradigms to accomplish things that could be done with one.

1

Good question. I can think of two reasons why translate is necessary:

  • Some elements (like a path and line) don't have x and y attributes.
  • When applying a translation to a group (<g>) of multiple objects, how would this be done using only x and y? SVG elements inside of the group like a <line> could have x1 and y1 attributes, some could be paths, etc. A translate fixes those issues.

In general translates could be removed and converted into other properties. It's just more of a hassle to do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.