Re: Some questions regarding transformations in SVG

The topic of more general transformations is an interesting one, although I
think getting the 3D transformations spec finalized is the priority for the
near term.

That said, the 3D transforms themselves add important new flexibility to
create unusual transformations.

The "affine" transformations implemented in SVG can all be described as
linear combinations of the x and y coordinates and a constant.  This is why
they can be implemented easily through 3x3 matrices.  The effect of those
mathematical constraints is that straight lines always remain straight, and
parallel lines always remain parallel (although perpendicular lines do not
always remain perpendicular, since you can skew the axes).

The 3D transformations are affine transformations of x,y,z coordinates,
implemented as 4x4 matrices.  However, since computer screens are still 2D
(despite all the hologram displays on science fiction TV shows), an
implicit aspect of rendering a 3D transform is the projection that converts
x,y,z coordinates back to 2D.

(Note that z-index is NOT part of 3D transforms.  It controls paint order,
but each painted layer is still part of the same infinitely thin plane.)

After the projection back to 2D, the final transformation is no longer
affine.  Straight lines are still straight.  However, parallel lines may no
longer be parallel; instead, they may angle towards a vanishing point
created by the perspective effect.

The CSS transformation specs [http://www.w3.org/TR/css3-transforms/] define
two primary ways to control the effect of the projection: by setting the
separate perspective and perspective-origin properties on a container
element, or by inserting a persepective(length) function within your
transformation.

However, you can also specify the 4x4 matrix yourself, which could open up
great flexibility, if you knew what you were doing.  You can end up with
transformations that don't really look like a proper 3D projection of the
original shape, with separate "vanishing points" for the x and y axes.

See the 3D matrix example here:
http://codepen.io/AmeliaBR/pen/KwKJaQ?editors=110

I have no idea what the mathematical name for this class of transformations
would be.  I also don't yet have a firm mental grasp on how the different
matrix values are converted into the rendered image.  The example above I
created just by playing around with the parameters until I got something
that looked distorted.

If you're interested in exploring the possibilities of the 4x4
transformation matrix + projection, a section in the draft specs defines
how it should work:
http://www.w3.org/TR/css3-transforms/#processing-of-perspective-transformed-boxes

If you are really comfortable with these transformations, you could propose
new shorthand functions to describe particular effects.  However, those
probably won't be considered until after the existing transformations spec
has been finalized.

Map projections and other curved projections such as fisheye magnification
would also be an area of interest for future versions of the transformation
specifications.  The effects would need to be clearly defined in function
format, with mathematical definitions of the transformation mapping process
(i.e., of the function to convert raw coordinates to transformed
coordinates) that could be efficiently implemented.

I hope that gets you thinking about the possibilities.  It is an
interesting topic, but as you have discovered, there have been other
priorities for SVG/CSS development.  Of course, if someone came up with
great proposals and matching implementations, that would get the ball
rolling.

In the meantime, please try to remember that no one owes you an
all-encompassing SVG specification (or implementation) that meets every
conceivable graphical need.  When you ask whether something has been
considered or why not, and you get a short and sweet answer to those
questions, that is not a reason to get offended.  When you ask if something
is possible, and you receive a reply that it isn't possible directly but
there is a workaround, the fair response is not to cry that this is not
good enough.

No one on this list has said that these would not be neat features to have,
only that they haven't been considered so far due to reasons of
practicality or competing priorities.

Amelia BR


On 16 November 2014 21:01, Rik Cabanier <cabanier@gmail.com> wrote:
>
> On Sun, Nov 16, 2014 at 12:43 AM, Juergen Roethig <
> roethig@dhbw-karlsruhe.de> wrote:
>>
>> I do not want "everything" out of "infinity", for sure! If
>> transformations other than affine ones had been discussed before in the SVG
>> WG, coming to some sort of conclusion, I will see what to make out of it.
>> Unfortunately, the specs (the existing 1.1 as well as the upcoming 2) as
>> well as my Google search on the topic (probably using the wrong keywords)
>> don't reflect such a discussion. That's why I ask what might have been
>> discussed before!
>>
>
> Can you give an example of what such non-affine transformations look like?
> Do you know of any tools that offer them?
>
>
>> Of course, "projective geometry" might be a candidate for such a class of
>> transformations, especially with regard to the z-index which hopefully
>> makes it in SVG2!
>>
>
> I don't understand why z-index is special. Can you eleborate?
>

Received on Monday, 17 November 2014 07:23:34 UTC