- From: Rik Cabanier <cabanier@gmail.com>
- Date: Thu, 30 Jan 2014 20:07:06 -0800
- To: css3@userks.e4ward.com
- Cc: "public-fx@w3.org" <public-fx@w3.org>
- Message-ID: <CAGN7qDC7Fg6JN_LHArJbBR-w_f0OMWV_AiLyN2pmTK5hXPXy7w@mail.gmail.com>
Hi Ken, thanks for your reply! It's great to hear the history of the algorithms we're taking for granted :-) When decomposing/recomposing a 3d matrix we are using quaternions: http://www.w3.org/TR/css3-transforms/#decomposing-a-3d-matrix For a while the spec applied the same math for 2d matrices but that sometimes gave intermediate 3d results. Apple's Safari always split out the 2 algorithms, but Google's Chrome still uses quaternions for everything. If you have access to these 2 browsers, you can see the difference in rendering here: http://jsfiddle.net/cabanier/Vv84m/embedded/result/ Rik On Wed, Jan 8, 2014 at 9:17 AM, <css3@userks.e4ward.com> wrote: > Greetings. > > It is delightful to see 3D capabilities coming to CSS styling. > > It is disappointing to see the choice for matrix interpolation. > > Specifically, I'm looking at Section 20: Interpolation of matrices. > > <http://www.w3.org/TR/css3-transforms/#matrix-interpolation> > > The draft standard specifies using a method found in Graphics Gems II, > edited by Jim Arvo. > > However, in 1992 I published a paper with Tom Duff, entitled "Matrix > Animation and Polar Decomposition", which has important advantages set > out there. > > <http://academic.research.microsoft.com/Paper/371892.aspx> > > For those who do not know the 3D computer graphics literature well, Tom > Duff (now at Pixar) has two Academy awards for technical contributions, > and I introduced quaternion animation to computer graphics. So perhaps > our ideas our worth considering. > > And if you had only looked at Graphics Gems IV, you would have found my > "Polar Matrix Decomposition" on pages 207 through 221, complete with > implementation code! > > <http://tog.acm.org/resources/GraphicsGems/gemsiv/polar_decomp/> > > > > We didn't have any special insight into meaningful ways to deal with > perspective elements in a general (4x4) matrix transform, so we > improvised for that. Translation is, of course, trivial to split off > from an affine transform. So the heart of the paper is how best to split > a (3x3) linear transform into meaningful primitives. > > I have great respect for Spencer Thomas, who wrote "unmatrix"; nor is he > the only one to have taken a stab at this puzzle. Animating matrices is > generally a method of last resort, and part of the problem is what > constitutes a good solution. > > We claim that a lesser-known numerical analysis split known as the Polar > Decomposition has a number of advantages over prior efforts, including > an explicit criterion for a good solution. > > For purposes of CSS transforms, note that it is trivial to compute the > Polar Decomposition of a 2x2 matrix. (The original paper explains how.) > > Since the paper was written, numerical analysts have found even more > clever ways to do the split in higher dimensions; 3x3 matrices require > little work even with a simple Newton iteration. > > Q_{0} = M > Q_{i+1} = ( Q_{i} + Q_{i}^{-T} ) / 2 > > That is, we set Q to the 3x3 matrix M, and repeatedly average Q with its > inverse transpose to converge Q to an orthogonal matrix. > > A non-singular matrix M has a unique nearest orthogonal matrix, which is > precisely what we will get -- and what we want. (See the paper.) > > Having cleanly split off M's rotation part (possibly with a negation) as > Q, what remains is purely scaling. > > S = Q^{T} M > > It is unrealistic to expect S to be diagonal; Polar Decomposition is > "physical", essentially independent of coordinate system. So S will in > general take the form it must when the scaling axes are not the same as > the matrix axes: it will be symmetric and non-negative definite. > > The paper lays out the options and implications for animation once we > have the split. > > > > If you have already considered and discarded Polar Decomposition, my > apologies. If not, I urge you to try it. > > -- Ken Shoemake > > > >
Received on Friday, 31 January 2014 04:07:36 UTC