Re: API for matrix manipulation

On Mar 14, 2011, at 6:54 PM, Joćo Eiras wrote:

> 
>>> 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").
>> 
> 
> Are those classes in their current implementations thread-safe ? Could a Web Worker easily do matrix calculations with them ? I would guess a basic physics engine in a worker would be a nice use case.

They are as thread safe as any other JavaScript classes, which is not at all :-)

As I understand it, the data would have to be serialized to be sent between Workers and the main thread.

> 
> And what about making something that is generic enough for both SVG and CSS, or even full blown algebra ? And then specify bindings of implicit conversions from those DOM classes into a basic ES matrix (if you would like to call it that) ?

Proposing a Matrix class in JavaScript is much different than adding classes to the browser to support the DOM API, which is what SVGMatrix and CSSMatrix are. I think it would be nice to unify the classes somehow. But that might be difficult since SVG and CSS are (necessarily) separate specs. But maybe one of the API gurus has a solution?

-----
~Chris
cmarrin@apple.com

Received on Wednesday, 16 March 2011 00:00:40 UTC