# Re: [css3-transforms] neutral element for addition - by animation

```Hi Dirk,

Le 6/4/2012 9:06 PM, Dirk Schulze a écrit :
> On Jun 4, 2012, at 11:58 AM, Cyril Concolato wrote:
>
>> Hi all,
>>
>> This thread is just too long for me at the moment, but I repeat what I
>> said. I think that the neutral element for by animations should be the
>> identity matrix. There is no mathematical problem. Adding a zero scale
>> (or rotate, or translate, or skew, ...) is equivalent to post
>> multiplying with the identity matrix.
> I thought it was a typo the last time. But scale(0) is definitely not the identity matrix.
>
> Identity transform is:
>
> | 1 0 0 |
> | 0 1 0 |
> | 0 0 1 |
>
> While scale(0) or scale(0,0) is equivalent to:
>
> | 0 0 0 |
> | 0 0 0 |
> | 0 0 1 |
>
> according to SVG 1.1.
Up to this point, I agree with you.

>
> The identity transform is the neutral element for multiplication, not for addition.
That's where I differ. The neutral element for addition of a scale
transform is 'e' such that for all X:
scale(X+e)=scale(X)
So yes e=0 but this does not mean a matrix of zeros.
If you decompose scale(X+e) with a product of scales:
scale(X+e)=scale(X)scale(e')=scale(X) for all X, then e'=1.
Applying a by animation of scale is post-multiplying with a scale
transform and the neutral element is the identity.

> For addition it is the zero matrix:
>
> | 0 0 0 |
> | 0 0 0 |
> | 0 0 0 |
>
> But that isn't even the point of Olaf and SMIL. SMIL says that the neutral element for addition according to a scalar is searched.
That's not really contradictory with what I said above.

> That is why animateTransform just takes scalars as values. So according to SMIL, it should really be 0 for translate, scale, rotate, skweX and skewY.
Yes, 0 as in scale(X+0)=scale(X).
>
> But that does not prevent us from changing it. Would just be one more difference to SMIL :).
I don't think this would be the case.

Cyril
>
> Greetings,
> Dirk
>
>> Cyril
>>
>> Le 6/2/2012 12:07 AM, Dirk Schulze a écrit :
>>> On Jun 1, 2012, at 1:51 AM, Dr. Olaf Hoffmann wrote:
>>>
>>>> Cyril Concolato:
>>>>
>>>>
>>>>> [CC] Adding 1 in the scale transformation means going from scale(X) to
>>>> scale(X+1), therefore the neutral element is scale(0) which is the identity
>>>> matrix.
>>>>
>>>> scale(0) is not the identity matrix, this is obviously scale(1,1),
>>>> because
>>>> (0,0) = scale(0,0) * (x,y) and for arbitrary x,y it is of course in most
>>>> cases (x, y)<>   (0,0); scale(0,0) is no representation of the identity matrix.
>>>> but
>>>> (x,y) = scale(1,1) * (x,y);  scale(1,1) is a representation of the identity
>>>> matrix.
>>>>
>>>> On the other hand the identity matrix has nothing to do with additive
>>>> animation or the neutral element of addition, therefore there is no
>>>> need, that it is the same. The identiy matrix is the neutral element
>>>> of matrix multiplication, what is a completely different operation.
>>> Like Cyril wrote, it was just a typo from him.
>>>
>>>> For the operation of addition of matrices M:  0:=scale(0,0) represents
>>>> a neutral element M = M + 0 = 0 + M, but typically this is not very
>>>> important for transformations in SVG or CSS.
>>> I added a first draft of  the definition for the 'neutral element of addition' to CSS Transforms [1]. The only problem that I see is with 'matrix', 'matrix3d' and 'perspective'. According to the definition of SMIL the values should be 0 (list of 0) as well. This would be a non-invertible matrix for 'matrix' and 'matrix3d' and a undefined matrix for 'perspective'. The interpolation chapter for matrices does not allow interpolation with non-invertible matrices [2]. Therefore 'by' animations on these transform functions will fall back to discrete animations and cause the element not to be displayed for half of the animation [3].
>>>
>>> Of course it could be possible to linearly interpolate every component of a matrix, but since this is not the desired effect for most use cases, we use decomposing of matrices before interpolations.
>>>
>>> [1] http://dev.w3.org/csswg/css3-transforms/#neutral-element
>>> [2] http://dev.w3.org/csswg/css3-transforms/#matrix-interpolation
>>> [3] http://dev.w3.org/csswg/css3-transforms/#transform-function-lists
>>>
>>>> The scale function could have been defined in the passed in
>>>> such a way, that the identity matrix results from the neutral
>>>> element of addtion, this works for example in this way:
>>>> scale(a,b) means scaling factors exp(a) and exp(b).
>>>> But this would exclude mirroring and is maybe more
>>>> difficult to estimate the effect for some authors.
>>>> A Taylor expansion approximation by replacing
>>>> exp(a) by (a+1) could save the mirroring, but not the
>>>> intuitive understanding of scaling.
>>>> Therefore there is no simple and intuitive solution to
>>>> satisfy all expectations - and too late to change the
>>>> definition anyway.
>>> I would also think it gets to complicated for most authors.
>>>
>>>> Olaf
>>>>
>>> Greetings,
>>> Dirk
>
```

Received on Monday, 4 June 2012 19:21:44 UTC