package geometry._theory { import away3d.primitives.Cube; import flash.geom.Matrix3D; import flash.geom.Orientation3D; import flash.geom.Vector3D; import triga.shapes.Tick; import triga.shapes.XYZ; /** * @author Nicolas Barradeau * http://en.nicoptere.net */ public class F_PositionScale extends BaseScene { private var ps:Cube; private var temoin:Cube; public function F_PositionScale() { cameraDistance = -250; setup(); addMesh( new XYZ(100), ps = new Cube(RED, 10,10,10), temoin = new Cube( WHITE, 10,10,10 ) ); RED.alpha = WHITE.alpha = .5; //creates a transform Matrix in 3D var mat:Matrix3D = new Matrix3D(); var sx:Number = 1; var sy:Number = 5; var sz:Number = 3; var tx:Number = -50; var ty:Number = 50; var tz:Number = -20; //compose the Matrix with our position / scale mat.rawData = Vector.( [ sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, tx, ty, tz, 1 ] ); //assign the matrix to the object ps.transform = mat; //notice that the translations and scaling can be set without affecting each other in the Matrix //it is not the case with rotations //alternate way of doing the same /* var position:Vector3D = new Vector3D( tx, ty, tz ); var rotation:Vector3D = new Vector3D(); var scale:Vector3D = new Vector3D( sx, sy, sz ); mat.recompose( Vector.( [ position, rotation, scale ] ) ); temoin.transform = mat; //*/ } } }