日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

AS3中變換矩陣的介紹

系統 2064 0

導讀:
  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中變換矩陣的介紹


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 凭祥市| 镇赉县| 平顶山市| 资溪县| 怀仁县| 句容市| 株洲市| 岚皋县| 永昌县| 玛曲县| 周至县| 德阳市| 大丰市| 台北县| 安岳县| 富阳市| 望都县| 资兴市| 康平县| 武安市| 手游| 宜都市| 呼和浩特市| 马山县| 乳源| 辽阳市| 嘉鱼县| 斗六市| 桦南县| 莱西市| 珠海市| 霍邱县| 怀化市| 乐业县| 义马市| 老河口市| 武清区| 茂名市| 汾西县| 尼勒克县| 安乡县|