2014-06-02 7:59 GMT-04:00 Robert O'Callahan <rob...@ocallahan.org>: > On Mon, Jun 2, 2014 at 3:19 PM, Rik Cabanier <caban...@gmail.com> wrote: > >> isIdentity() indeed suffers from rounding errors but since it's useful, >> I'm >> hesitant to remove it. >> In our rendering libraries at Adobe, we check if a matrix is *almost* >> identity. Maybe we can do the same here? >> > > One option would be to make "isIdentity" and "is2D" state bits in the > object rather than predicates on the matrix coefficients. Then for each > matrix operation, we would define how it affects the isIdentity and is2D > bits. For example we could say translate(tx, ty, tz)'s result isIdentity if > and only if the source matrix isIdentity and tx, ty and tz are all exactly > 0.0, and the result is2D if and only if the source matrix is2D and tz is > exactly 0.0. > > With that approach, isIdentity and is2D would be much less sensitive to > precision issues. In particular they'd be independent of the precision used > to compute and store store matrix elements, which would be helpful I think. >
+1 ! If we do want to keep the isIdentity and is2D methods, then indeed this is the right way do implement them. Benoit > > Rob > -- > Jtehsauts tshaei dS,o n" Wohfy Mdaon yhoaus eanuttehrotraiitny eovni > le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o Whhei csha iids teoa > stiheer :p atroa lsyazye,d 'mYaonu,r "sGients uapr,e tfaokreg iyvoeunr, > 'm aotr atnod sgaoy ,h o'mGee.t" uTph eann dt hwea lmka'n? gBoutt uIp > waanndt wyeonut thoo mken.o w > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform