java - How does AffineTransform work? -


how concatenation of matrices makes sense when defining operators? why there 3 dimensional matrices when dealing 2 dimensions? feel stupid asking lack kind of information though i'm quite familiar vector analysis , algebra... why aren't transformation or scaling matrices multiplied , applied operator coordinates?

i'm trying make zoom-to-mouse feature translatable-by-mouse grid , 2 days can't. there way use settranslate or setscale on transformer without resetting existing operator? how composition of concatenation work?

edit got zoom-to-and-from-a-point algorithm right... trick apply translations dependent on zoomlevel before apply else, while saving previous operator: (in case interested in this..)

    affinetransform savedtransform = new affinetransform(transformer);     affinetransform temptransform = new affinetransform();      temptransform.translate(-0.25*(mousex-transofgridxd-game.curws*sf*sqsize/2), -0.25*(mousey-transofgridyd-game.curws*sf*sqsize/2)); //sf zoom level, game.curws*sqsize grid size in pixels, transofgrid translation of transform     temptransform.concatenate(savedtransform);      transformer.settransform(temptransform );     transformer.translate(-(game.curws)*sqsize*0.125, -(game.curws)*sqsize*0.125);      transformer.scale(1.25, 1.25); 

wikipedia has lot on affine transformations. using 3x3 matrix multiplication, can perform rotation, reflection and translation @ same time.

i.e. instead of computing d*(c*(b*(x+a)+b)+c)+d of these operations can put single matrix operation m*x' (where x' vector x row). matrix multiplication can implemented in hardware (that's 3d graphics cards - optimize 4d multiplications - printer has optimized circuits 3d multiplication!)


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -