Better matrix decomposition for animation

Hi,

I was reading the CSS 2D Transforms Module Level 3 W3C Working Draft 01
December 2009 today.

http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition

And it occurred to me that the "7. Matrix decomposition for animation" is
incongruous to the rest of the document in that it results in 3d operations
that cannot be expressed as CSS 2D transforms!  It's also unnecessarily
complex, unstable, and generally overcomplicated because it's a general
routine decomposing a 3d matrix whereas we just need a 2d matrix
decomposition.  So I derived one today.  Not tested, but is very easy to
derive and test.

A matrix(a,b,c,d,e,f) transform is decomposed into the following simple
transforms:

  transform(e,f) rotate(r) skew(s) scale(aa,dd)

Where:

  r  = atan2(b, a);
  aa = sqrt(a*a+b*b);
  cc = cos(r)*c - sin(r)*d;
  dd = sin(r)*c + cos(r)*d;
  s  = atan2(cc,dd);

That's all.  I find this considerably simpler, much faster, more stable, and
more intuitive than of the 5 pages worth of code currently listed in the spec.

Or am I completely missing the point?

My 0.02CAD,
behdad

Received on Wednesday, 22 September 2010 19:21:11 UTC