W3C home > Mailing lists > Public > www-svg@w3.org > January 2005

Re: SVG 1.1 Spec Rec - 7.6 The Transform Attribute

From: Ian Brown <ianbrown@istar.ca>
Date: Wed, 26 Jan 2005 11:33:53 -0500
Message-ID: <000a01c503c4$d35789d0$758dfea9@ianspc>
To: "Thomas DeWeese" <Thomas.DeWeese@Kodak.com>
Cc: <www-svg@w3.org>

 Hi Thomas

Thanks for your prompt, intelligent and absolutely correct response.

You are right I was applying the transformations to the geometry, not the 
coordinate systems. After re-reading the SVG spec with your comments fresh 
in my mind, the spec became more clear. As you point out the spec calls for 
the coordinate system to be transformed not the geometry.

I have been writing a graphics API using the the pre-concatenate/geometry 
aproach and just had that frame of reference in my head. (As Foley & Van Dam 
state on this topic: "Any desired result can be ahieved in either mode by 
explicitly specifying the transformations in the appropriate order.")

Thanks again for taking the time to respond with insight and an example.

Sincerely

ian

----- Original Message ----- 
From: "Thomas DeWeese" <Thomas.DeWeese@Kodak.com>
To: "Ian Brown" <ianbrown@istar.ca>
Cc: <www-svg@w3.org>
Sent: Wednesday, January 26, 2005 8:48 AM
Subject: Re: SVG 1.1 Spec Rec - 7.6 The Transform Attribute


> Hi Ian,
>
>    The basic problem is that the transform attribute describes the
> transformation from one coordinate system to another not the
> transformation of the geometry (this would be problematic as it
> wouldn't work for groups).
>
>    I'll go through your example using the coordinate system not
> the geometry.
>
> Ian Brown wrote:
>
>> Take a rectangle at (0,0) of width and height 30.
>
>    Take an inital coordinate system (C1)
>
>> Translate it to (200, 0)
>> We then have a rectangle at (200, 0) of width and height 30.
>
>    Create a new coordinate system (C2) translated by 200,0.  We now
> have a coordinate system with it's origin at location 200,0 in
> the original coordinate system (C1).
>
>> Now rotate that rectangle by 45 degrees (about 0,0).
>
>    Now create another new coordinate system (C3) by rotating the
> cooridinate system (C2) by 45 degrees around it's origin, which is
> at location 200,0 in the original coordinate system (C1).
>
>>(remember the rectangle now has an upper left at 200,0 and lower right at 
>>230,30)
>> What do we expect? We expect the upper left and upper right points of the 
>> square to lie along the 45 diagonal passing through 0,0
>> i.e. the rotation is about 0,0 not 200,0. The upper left conner will be a 
>> distance of 200 from 0,0.
>
>    Now define a rectangle in the final coordinate system (C3), such
> that it starts at 0,0 and has a width/height of 30.
>
>> That is not what Adobe SVG or Amaya does.
>
>    The above is what Adobe, Amaya, Batik, and Mozilla do.
> Please see the attached SVG that illustrates the coordinate
> systems involved.
>
>> The spec should not be compromised by the implementation.
>> Interpreting the spec according to "matrix order rules" (backwards to 
>> English?) is interpreting the spec based on using a matrix based 
>> implementation. This is highly confusing, and inappropriate.
>> Further since the matrix order for pre-concatenation is opposite to 
>> post-concatenation the spec would have specify pre or post rules.
>
>    The problem is that you are trying to apply the transformation
> to the geometry not to the coordinate system.  The transform attribute
> defines the coordinate system that the rectangles coordinates are
> evaluated in it does not define a transformation of the rectangle.
>
> ----
>
> <svg width="400" height="400"
>      xmlns:xlink="http://www.w3.org/1999/xlink"
>      xmlns="http://www.w3.org/2000/svg"
>      viewBox="-20 -20 390 390">
>
>    <symbol id="axis" stroke-width="2"
>            viewBox="0 0 100 100" overflow="visible"
>            stroke-linecap="round" >
>           <line x1="0" y1="0" x2="90" y2="0"/>
>           <line x1="0" y1="0" x2="0"  y2="90"/>
>           <path d="M0 100 l3-10 h-6z" stroke="none"/>
>           <path d="M100 0 l-10,3 v-6z" stroke="none"/>
>    </symbol>
>
>    <g stroke="black" fill="black">
>       <use x="0" y="0" width="300" height="300"
>            xlink:href="#axis"/>
>       <text x="10" y="30" font-size="20" stroke="none">C1</text>
>    </g>
>
>    <g transform="translate(200, 0)" stroke="blue" fill="blue">
>       <use x="0" y="0" width="300" height="300"
>            xlink:href="#axis"/>
>       <text x="50" y="30" font-size="20" stroke="none">C2</text>
>    </g>
>
>    <g transform="translate(200, 0) rotate(45)"
>       stroke="green" fill="green">
>       <use x="0" y="0" width="300" height="300"
>            xlink:href="#axis"/>
>       <text x="50" y="30" font-size="20" stroke="none">C3</text>
>
>       <rect x="0" y="0" width="30" height="30"
>             fill="purple" fill-opacity="0.5"/>
>    </g>
> </svg>
> 
Received on Wednesday, 26 January 2005 16:34:22 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:29 GMT