I am using actionscript 3.0 and I don’t understand what give us the Transform class??
import flash.geom.Matrix;
var mat1:Matrix = new Matrix();
mat1.identity();
mat1.rotate(Math.PI/4);
mat1.scale(2,2);
mat1.translate(10,20);
those things I can do with:
var shape:Shape = new Shape();
shape.x = 50; //the same as the translate tx
shape.y = 50; //the same as the translate ty
shape.rotation = 45; // the same as the rotate
shape.scaleX = 20; // the same as the scale X in Matrix object
shape.scaleY = 30; // the same as the scale Y in Matrix object
or the question is: What is the difference between the Matrix object methods or the Shape, MovieClip, Sprite methods that do the same thing???, I really don’t understand this, maybe I’am missing something?
For one matrix operations are probably faster,
For seconds you can easily do perform several operations on a matrix and then easily apply it on several different objects, you can also skew your points with a matrix but can’t directly with a shape. This is what a linear transformation is all about.
Linear Map in Wikipedia
Notice the transform point method.
As for your second question, it depends on what you’re using it for, if you want to perform the same transformation on several similar points you should consider building a matrix once and then applying it on every point.