From: Chris Marrin <cmarrin@apple.com>

Date: Mon, 14 Mar 2011 09:17:07 -0700

Cc: public-webapps <public-webapps@w3.org>

Message-id: <657966F1-6100-4D0B-A177-B6BB045E85D3@apple.com>

To: Joćo Eiras <joao.eiras@gmail.com>

Date: Mon, 14 Mar 2011 09:17:07 -0700

Cc: public-webapps <public-webapps@w3.org>

Message-id: <657966F1-6100-4D0B-A177-B6BB045E85D3@apple.com>

To: Joćo Eiras <joao.eiras@gmail.com>

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, 28850, 50633, 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.comReceived on Monday, 14 March 2011 16:18:26 UTC

*
This archive was generated by hypermail 2.3.1
: Friday, 27 October 2017 07:26:30 UTC
*