On Jun 8, 2014, at 6:38 AM, Benoit Jacob <jacob.benoi...@gmail.com> wrote:

> Note that the current way that isIdentity() works also fails to offer that
> characteristic, outside of accidental cases, due to how floating point
> works.


DOMMatrix focuses on CSS, SVG and HTML which are not limited to value range of 
-1 to 1. Values of 2, 4, 100 or values with x.5, x.25 are much more likely to 
occur. For these cases, translation and untranslation is more likely an 
identity matrix again. Same for scale and unscale. Of course, transformations 
with rotation are more likely to create a matrix that is close to identity but 
not exactly identity.  We can not prevent deviations on matrix transformations. 
We can not even prevent deviation on simple operations like multiplication or 
division. A visual example was posted on public-fx was:

""
"Math.sqrt(x)*Math.sqrt(x) === x" evaluates to false if x isn't a perfect 
square (integer or not).
""

This is still no issue though. As said before, the purpose of isIdentity() is 
to optimize code. And isIdentity() can be used to optimize all cases that can 
be optimized by roc's and Rik's proposed method plus many more (if not the vast 
majority) of actual real world use cases. In the worst case, the optimization 
does not happen which wouldn’t without isIdentity() anyway.

Greetings,
Dirk
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to