Problem with SVG transformations

M.Barren

Usenet Archive
Joined
Nov 30, 2006
Messages
2
Reaction score
0
Hi,

I'm a newbie in SVG, I've been trying to get the svg below working for sometime now, I need help:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" zoomAndPan="disable">

<g transform="translate(10mm,10mm)">
<rect x="0mm" y="0mm" width="100mm" height="30mm" style="fill:red;stroke:black;stroke-width:1mm"/> </g> </svg>

The "translate(10mm,10mm)" doesn't work unless i get rid of the units. Without the units, how can I tell it 10 is in mm and not in cm or inch or pixel or ... ?

Any help would be appreciated
 

Joe Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
1,229
Reaction score
0
The "translate(10mm,10mm)" doesn't work unless i get rid of the units. Without the units, how can I tell it 10 is in mm and not in cm or inch or pixel or ... ?

Transformation is implemented as a matrix-multiplication operation upon the coordinates. As such, it is unitless; the units are those of the original coordinates it is being applied to. See the detailed descriptions at http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace

(If you aren't familiar with matrix math operations, you really should invest a bit of time in learning about them -- they're a fairly basic tool for computer graphics work.)
 

Joe Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
1,229
Reaction score
0
Joe said:
the coordinates. As such, it is unitless

.... or at least, that's how I read it. Certainly the scaling columns have to be unitless (you don't want to multiply cm by cm when the result is supposed to be cm). I suppose the additive column could and perhaps should carry units, but I don't see provision for that in the spec. I may be missing something (and whoever implemented the version you're using may have missed the same thing I did), but...
 

M.Barren

Usenet Archive
Joined
Nov 30, 2006
Messages
2
Reaction score
0
Joe said:
Transformation is implemented as a matrix-multiplication operation upon the coordinates. As such, it is unitless; the units are those of the original coordinates it is being applied to. See the detailed descriptions at http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace

(If you aren't familiar with matrix math operations, you really should invest a bit of time in learning about them -- they're a fairly basic tool for computer graphics work.)
Thanks joe for the the reply,
I have looked into the spec before, not only that page but many other pages as well and I ended up not finding a solution, I'm familiar with matrices and if you know a solution, please post a sample svg code to show that, I'm really frustrated as even a google search on this didn't get me anywhere.
Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,244
Members
248,133
Latest member
DujonT

Latest Threads

Top