- From: Lars Knudsen <larsgk@gmail.com>
- Date: Mon, 14 Mar 2011 20:19:06 +0100
- To: Chris Marrin <cmarrin@apple.com>
- Cc: Joćo Eiras <joao.eiras@gmail.com>, public-webapps <public-webapps@w3.org>
- Message-ID: <AANLkTi=01DEzwaHn8+V-4eL5Pp08Sr6Wr3SszZPaY73F@mail.gmail.com>
Hi, related to this: Is there any work ongoing to tie these (or more generic vector / matrix) classes to OpenCL / WebCL for faster computation across CPUs and GPUs? - Lars On Mon, Mar 14, 2011 at 5:17 PM, Chris Marrin <cmarrin@apple.com> wrote: > > On Mar 14, 2011, at 7:56 AM, Joćo Eiras wrote: > > Hi. > > Given that a number of API are being developed that require complex > matricial calculations (transforms, device orientation, web gl), I > would suggest that perhaps an API with a big number of common > calculations could be made available ? And a proper way to represent > them. Perhaps, the best way to add this would be to extend the Math > object with things like. > > Math.mAdd(m1, m2) > Math.mSub(m1, m2) > Math.mMult(m1, m2) > Math.mDiv(m1, m2) > Math.mInverse(m1) > Math.mGaussianReduce(m1) > Math.mRank(m1) > Math.mRank(m1) > > Being the matrix an array like object like (could even be one of those > fast arrays like ArrayBuffer). > > # { > # w: <width>, > # h: <height>, > # length: <width * heigth> > # 0: ..., > # 1: ..., > # 2: ... > # (...) > # } > > Comments or is something already being worked on ? > > > There are already 2 such classes: SVGMatrix and CSSMatrix. The former is an > affine transformation matrix (commonly misnamed a "2x3 matrix") and the > latter is a 3D homogeneous transformation matrix (commonly correctly named a > "4x4 matrix"). > > We added CSSMatrix to the CSS Transform Spec to give us the same > functionality as SVG Matrix, but for 3D transforms. Therefore both of these > classes are pretty light on their operators. It might be useful to discuss > "one matrix to rule them all", which could be used in place of the current > classes and with more functionality. But it's important not to go too far > down this path, or you'll end up defining classes for Points, Lines, Planes, > Bounding Boxes and View Volumes with dozens of functions. Down that path > lies madness. > > I think the current spec handles the more complex (inverse and multiply) > and more commonly used (scale, rotate, translate) functions. I'm not sure > what adding and subtracting 2 matrices means, and division is handled by > inverse and multiply. The others seem pretty domain specific for a general > class. And remember you can (and many people have) created JS libraries to > add funcrtions to the built-in matrix classes. I wrote one: > > > https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/webkit/resources/J3DIMath.js > > which uses CSSMatrix if it exists and uses JS otherwise. It exposed some > interesting deficiencies in the current CSSMatrix class. There are several > bugs on WebKit to address these and other issues of matrix efficiency and > functionality: 23799 <https://bugs.webkit.org/show_bug.cgi?id=23799>, > 28850 <https://bugs.webkit.org/show_bug.cgi?id=28850>, 50633<https://bugs.webkit.org/show_bug.cgi?id=50633> > , 52488 <https://bugs.webkit.org/show_bug.cgi?id=52488>. Perhaps it would > be useful to open these (or similar) bugs on the w3c bug system? > > That's where I believe we are on the Matrix front. > > ----- > ~Chris > cmarrin@apple.com > > > > >
Received on Tuesday, 15 March 2011 15:33:30 UTC