W3C home > Mailing lists > Public > www-style@w3.org > April 2012

Re: [css3-transforms] rendering of objects transformed with non-invertable matrix

From: Dirk Schulze <dschulze@adobe.com>
Date: Sun, 22 Apr 2012 10:44:57 -0700
To: "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>
CC: "www-style@w3.org" <www-style@w3.org>, "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <3A45FA8D-CBEB-4E6D-A992-B5A13C9910B9@adobe.com>

On Apr 22, 2012, at 9:14 AM, Dr. Olaf Hoffmann wrote:

> Hello,  
> 
> this is about:
> http://www.w3.org/TR/2012/WD-css3-transforms-20120403/#animation
> 
> In the last paragraph of 15. it is mentioned:
> [In some cases, an animation might cause a transformation matrix to be 
> singular or non-invertible. For example, an animation in which scale moves 
> from 1 to -1. At the time when the matrix is in such a state, the transformed 
> element is not rendered.]
> 
> Because SVG tiny 1.2 has and maybe future versions of SVG will 
> have the property vector-effect="non-scaling-stroke", it is a real use 
> case to have objects, transformed to 1D or 0D objects, which remain 
> visible, for example with this one can create a simple presentation of 
> an 1D harmonic oscillator, using rotation, one direction transformed to
> zero.
> 
> Therefore I think, it is not a good idea to say that the object is not
> rendered, because this will not be the effect intended by the author
> and there is no simple workaround to get the same effect with
> another method.
SVG 2 will have the 'non-scaling-stroke' feature. And I am working on a possible issue with 'non-scaling-stroke' and 3D transforms [1]. 

Anyway. How do you want to draw a figure on a singular matrix? You can't draw the figure, so the value of 'vector-effect' doesn't matter at all:

<svg xmlns="http://www.w3.org/2000/svg">
  <rect width="100" height="100" vector-effect="non-scaling-stroke" transform="scale(0)" stroke-width="100" stroke="black" fill="none"/>
</svg>

In this example the transform of the rect has a singular matrix, caused by scaling by the factor of 0. Therefore the figure can't get painted at all. How can 'non-scaling-stroke' make a difference here?
It doesn't even matter if the ancestor node had this transform:


<svg xmlns="http://www.w3.org/2000/svg">
  <g  transform="scale(0)">
    <rect width="100" height="100" vector-effect="non-scaling-stroke" stroke-width="100" stroke="black" fill="none"/>
  </g>
</svg>

You can verify it in all current browsers with 'non-sclaing-stroke support' (Opera, Safari, Chrome) and Batik. At least from an implementation point of view you want the local to root transform to be invertible.

> 
> Indeed, because for animation there is no need to invert a matrix
> at all - the problem with the inversions seem to be only an artifact
> of 16.1., not related to the intended animation effect, I suggest to
> skip this paragraph.  For example, nothing specific happens at 0,
> if one scales from 1 to -1 - there is no reason not to render the 
> object continuously for such an animation.
Browsers use a different approach: quaternions [2]. I'll try to update this paragraph in the next days. But even so, what do you want to draw on scale(0)?

> 
> Maybe this is already an indication, that 16.1 should be improved,
> if it introduces problems, that have nothing to do with the intended
> animation effect (it is a well known thing, that one should avoid 
> numerical matrix inversion, if possible; the inversion algorithm may
> already cause trouble around the situation, where it becomes
> non-invertable, resulting in funny numerical artifacts) ...
> 
> 
> 
> Best wishes
> 
> Olaf
> 
> 
> 

Greetings,
Dirk

[1] http://lists.w3.org/Archives/Public/public-fx/2012JanMar/0173.html
[2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=15960
Received on Sunday, 22 April 2012 17:45:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT