AS3中变换矩阵的介绍(翻译转载)
来源:互联网 发布:手机sd卡数据恢复工具 编辑:程序博客网 时间:2024/05/18 02:44
导读:
In this lesson, I shall introduce to you, the Matrix Class. Out of all the concepts to cover in Flex 2 and AS3, why did I choose to cover this topic? Well, believe it or not, the Matrix class has been around for quite some time now in Actionscript. If you’re really interested in the idea of 3D vector spaces in Flash/Flex, then this may be a subject that you may want to further look into. For now, we’ll keep this lesson simple and lay off the heavy mathematics that you’d normally find in a full course study of linear algebra.
在这里我将向大家试讲一堂矩阵课,FLEX2和AS中有那么多的课题可以介绍,为什么我偏偏介绍这个话题呢?当然,无论你相信与否,举证在AS中存在已经很久了,如果你对FLASH &FLEX中的3D空间向量很感兴趣的话,这一课也许是正是你所需要的课程,现在我们尽可能的保持简单,并且放下繁重的数学知识,关于矩阵的知识你可以在线性代数中找到详细的讨论
First things first, what is a transformation matrix? Basic answer: A transformation matrix is a shorthand way of describing the positioning, rotating, and sizing of an object. When a transformation matrix is applied to an object it will often be in a different place, orientation, and size afterwards. A transformation matrix is a 3 x 3 matrix with the following contents:
首先,首先要提到的,什么是变换举证?基本的回答是:一个变换举证是一种非常便捷的方式来刻画图像对象的位置,伸缩,旋转。当一个变换矩阵被应用得到一个对象,通常在对于这些对象在不同的地点,方向,大小。一个变换矩阵通常是一个3*3的矩阵
Within the Matrix Class we have read/write access to the following member variables of the Matrix Class: 在这个矩阵类里面我们可以读写一下的矩阵属性
a- x scale a-代表X轴方向拉伸
b- y skew b-代表Y方向斜拉伸
c- x skew c-代表X方向斜拉伸
d- y scale d-代表Y方向拉伸
tx- x translation ( positioning along the x axis ) TX-代表X方向位移
ty- y translation ( positioning along the y axis ) TY-代表Y方向位移
The Matrix values for u, v, and w cannot be modified and assume the values 0, 0, and 1, respectively. U,V,W不能被修改默认分别为0,0,1
The Matrix class offers four methods to perfrom matrix transformations: Translation, Scaling, Rotation, and Skewing. 矩阵类提供了四个方法来进行对象的变换,包括Translation, Scaling, Rotation, and Skewing。下面依次讲解
TRANSLATE 平移变换
Description:Moves an image tx pixels to the right and ty pixels down. 将图像沿着X,或者Y轴平移
Syntax:
vart_matrix : Matrix = newMatrix()
t_matrix.translate(tx, ty )
SCALE 伸缩变换
Description:Resizes an image, multiplying the location of each pixel by sx on the x-axis and sy on the y-axis. 伸缩图像,X,Y方向的伸缩因子分别为SX,SY
Syntax:
vart_matrix : Matrix = newMatrix()
t_matrix.scale(sx, sy )
ROTATION 旋转变换
Description:Rotates an image by an angle q, which is measured in radians. 将图像旋转Q度(弧度)
Syntax:
vart_matrix : Matrix = newMatrix()
t_matrix.rotate(q )
SKEWING/SHEARING 斜拉伸
Description:Progressively slides the image in a direction parallel to the x or y axis. The b property of the Matrix object represents the tangent of the skew angle along the y axis; the c property of the Matrix object represents the tangent of the skew angle along the x axis. 将图像沿着X,Y轴平行的方向斜拉神,
Syntax:
vart_matrix : Matrix = newMatrix()
t_matrix.b= b;
t_matrix.c= c;
To alter a matrix, you can use one or more (multiple) combinations of the above methods to transform a matrix. 要改变一个变化矩阵你可以组合使用以上的变换方法来构造一个变换举证
The demo app below, illustrates the basic matrix transformation operations discussed above. Observe the translation matrix values as you modify the slider values. You may view/download the source for reference. 下面的DEMO(读者可以到原链接的文章上去看)展示了如何使用这些基本的变化来进行图像的变化
And finally, how is this practically useful in a flex application, you might ask? One use is coding a custom effect and effect instance. Maybe you might want to implement a flip or rotation effect when transitioning off to another view. Another use may involve the need for 3D imaging. Application spaces may include anything from building-architecture, medical imaging, automotive modeling, etc. 你也许要问,有什么用呢?其中一个用处就是用来制作效果。例如旋转啊,3D构图,倒影什么的,关键就看你的想象力了
本文转自
http://cynergysystems.com/blogs/page/keunlee?entry=transformation_matrices_in_as3
- AS3中变换矩阵的介绍(翻译转载)
- AS3中利用matrix矩阵变换实现上下左右转置反转
- as3.0的ColorMatrixFilter颜色矩阵滤镜详细介绍
- SQL语句中简单的矩阵变换
- 图形学中几个变换矩阵的推导
- svg中transform的矩阵变换原理
- svg中transform的矩阵变换原理
- Matlab中矩阵的基本变换
- AS3 的简单变换效果
- java第五周(矩阵中数据的位置变换功能、矩阵的加法功能、矩阵的乘法功能)
- as3中颜色矩阵滤镜ColorMatrixFilter的使用
- AS3][Matrix][利用颜色矩阵进行颜色变换]
- 点的变换(矩阵转化)
- (8)矩阵的初等变换
- OpenGL的变换矩阵
- 矩阵的坐标变换
- 矩阵的空间变换
- 矩阵的初等变换
- 使用列表控件
- 个人发展 2.0
- 软件模型分析_笔记
- /dev/null 于 /dev/zero文件
- valgrind 介绍
- AS3中变换矩阵的介绍(翻译转载)
- java 获得系统时间
- 修复硬盘坏道黄金搭档:FbDisk和Diskgen
- 我的第一次
- vc文件操作
- 绝处逢生
- busybox 初始化
- Ext的Grid列表实现
- Debian安装笔记