青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

C++ Programmer's Cookbook

{C++ 基礎(chǔ)} {C++ 高級(jí)} {C#界面,C++核心算法} {設(shè)計(jì)模式} {C#基礎(chǔ)}

Managed DirectX --- Matrix&Transform(Translation and Scaling and Rotation)

  • 一 Translation

The following transformation translates the point (x, y, z) to a new point (x', y', z').

Translate 18

You can manually create a translation matrix in managed code. The following C# code example shows the source code for a function that creates a matrix to translate vertices.

						[C#]
						
private Matrix TranslateMatrix(float dx, float dy, float dz) { Matrix ret; ret = Matrix.Identity; ret.M41 = dx; ret.M42 = dy; ret.M43 = dz; return ret; }

For convenience, managed the Microsoft Direct3D supplies the Translation method.

  • 二 Scaling

The following transformation scales the point (x, y, z) by arbitrary values in the x-, y-, and z-directions to a new point (x', y', z').

Matrix scale?


  • 三?? Rotation

?

The transformations described here are for left-handed coordinate systems, and so might be different from transformation matrices that you have seen elsewhere. For more information, see 3-D Coordinate Systems.

The following transformation rotates the point (x, y, z) around the x-axis, producing a new point (x', y', z').

Matrix x rotation

The following transformation rotates the point around the y-axis.

Matrix y rotation

The following transformation rotates the point around the z-axis.

Matrix z rotation

In these example matrices, the Greek letter theta (?) stands for the angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

In a managed application, use the Matrix.RotationX, Matrix.RotationY, and Matrix.RotationZ methods to create rotation matrices. The following C# code example demonstrates how the Matrix.RotationX method performs a rotation.

				[C#]
				
private Matrix MatrixRotationX(float angle) { double sin, cos; sin = Math.Sin(angle); cos = Math.Cos(angle); Matrix ret; ret.M11 = 1.0f; ret.M12 = 0.0f; ret.M13 = 0.0f; ret.M14 = 0.0f; ret.M21 = 0.0f; ret.M22 = (float)cos; ret.M23 = (float)sin; ret.M24 = 0.0f; ret.M31 = 0.0f; ret.M32 = (float)-sin; ret.M33 = (float)cos; ret.M34 = 0.0f; ret.M41 = 0.0f; ret.M42 = 0.0f; ret.M43 = 0.0f; ret.M44 = 1.0f; return ret; }

  • 四? Matrix Concatenation

One advantage of using matrices is that you can combine the effects of two or more matrices by multiplying them. This means that, to rotate a model and then translate it to some location, you do not need to apply two matrices. Instead, you multiply the rotation and translation matrices to produce a composite matrix that contains all of their effects. This process, called matrix concatenation, can be written with the following formula.

Matrix concatination

In this formula, C is the composite matrix being created, and M1 through Mn are the individual transformations that matrix C contains. In most cases, only two or three matrices are concatenated, but there is no limit.

Use the Matrix.Multiply method to perform matrix multiplication.

The order in which the matrix multiplication is performed is crucial. The preceding formula reflects the left-to-right rule of matrix concatenation. That is, the visible effects of the matrices that you use to create a composite matrix occur in left-to-right order. A typical world transformation matrix is shown in the following example. Imagine that you are creating the world transformation matrix for a stereotypical flying saucer. You would probably want to spin the flying saucer around its center - the y-axis of model space - and translate it to some other location in your scene. To accomplish this effect, you first create a rotation matrix, and then multiply it by a translation matrix, as shown in the following formula.

World Space explanation

In this formula, Ry is a matrix for rotation about the y-axis, and Tw is a translation to some position in world coordinates.

The order in which you multiply the matrices is important because, unlike multiplying two scalar values, matrix multiplication is not commutative. Multiplying the matrices in the opposite order has the visual effect of translating the flying saucer to its world space position, and then rotating it around the world origin.

No matter what type of matrix you are creating, remember the left-to-right rule to ensure that you achieve the expected effects.

到底什么時(shí)候在左邊什么時(shí)候在右邊?


總結(jié):

  • 五 3-D Transformations


In applications that work with 3-D graphics, geometrical transformations can be used to do the following.

  • Express the location of an object relative to another object.
  • Rotate and size objects.
  • Change viewing positions, directions, and perspectives.

You can transform any point (x,y,z) into another point (x', y', z') using a 4 x 4 matrix.

Matrix multiply

Perform the following operations on (x, y, z) and the matrix to produce the point (x', y', z').

Matrix expanded

The most common transformations are translation, rotation, and scaling. You can combine the matrices that produce these effects into a single matrix to calculate several transformations at once.

posted on 2006-05-09 16:10 夢(mèng)在天涯 閱讀(1444) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): DirectX

公告

EMail:itech001#126.com

導(dǎo)航

統(tǒng)計(jì)

  • 隨筆 - 461
  • 文章 - 4
  • 評(píng)論 - 746
  • 引用 - 0

常用鏈接

隨筆分類(lèi)

隨筆檔案

收藏夾

Blogs

c#(csharp)

C++(cpp)

Enlish

Forums(bbs)

My self

Often go

Useful Webs

Xml/Uml/html

搜索

  •  

積分與排名

  • 積分 - 1817385
  • 排名 - 5

最新評(píng)論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              亚洲一区二区三区高清| 欧美日本国产在线| 欧美高清影院| 日韩午夜精品视频| 国产精品久久久久影院色老大| 亚洲欧美日韩高清| 美女精品一区| 亚洲天堂黄色| 国产主播精品在线| 欧美成人有码| 亚洲综合三区| 欧美激情亚洲激情| 亚洲小视频在线| 激情久久综合| 欧美日韩在线另类| 久久国产精品一区二区| 亚洲精品韩国| 欧美一区国产一区| 亚洲精品午夜精品| 国产午夜亚洲精品不卡| 欧美久色视频| 久久成人精品无人区| 亚洲伦理在线免费看| 久久久久久久综合日本| 一本大道久久a久久精品综合 | 鲁大师影院一区二区三区| 亚洲免费电影在线观看| 久久乐国产精品| 亚洲视频1区2区| 在线视频成人| 国产精品夜夜夜一区二区三区尤| 久久夜色精品国产亚洲aⅴ| 亚洲视频中文字幕| 亚洲国产合集| 久久人人97超碰精品888| 亚洲一区亚洲| 日韩视频在线一区| 黄色成人免费网站| 国产精品毛片a∨一区二区三区| 久久只有精品| 欧美专区第一页| 宅男精品视频| 亚洲免费成人| 亚洲国产电影| 欧美国产第二页| 久久夜色精品国产噜噜av| 亚洲欧美日韩在线播放| 一区二区三区欧美日韩| 亚洲欧洲日韩在线| 亚洲第一久久影院| 好吊妞**欧美| 国产丝袜一区二区| 国产精品亚洲美女av网站| 欧美三级在线视频| 欧美日韩国产bt| 欧美激情综合网| 欧美成人在线网站| 欧美高清hd18日本| 欧美成人免费观看| 免费成人美女女| 美日韩精品视频| 免费一级欧美片在线播放| 麻豆久久久9性大片| 久久中文字幕一区| 免费亚洲电影在线| 欧美韩国日本一区| 欧美激情在线有限公司| 欧美日韩国产欧美日美国产精品| 欧美理论大片| 国产精品成人观看视频国产奇米| 欧美视频在线观看 亚洲欧| 欧美性大战久久久久久久| 欧美特黄一级大片| 国产精品嫩草久久久久| 国产精品免费看| 国产日本欧美一区二区| 国产日韩欧美a| 一区三区视频| 亚洲欧洲中文日韩久久av乱码| 亚洲精品一区二区在线| 一区二区三区免费在线观看| 亚洲在线免费观看| 久久精品一区二区三区四区| 久久一综合视频| 欧美激情精品久久久久久蜜臀 | 国产亚洲精品bt天堂精选| 国产视频在线观看一区二区三区| 国产欧美一区二区精品忘忧草| 国产一级精品aaaaa看| 在线观看亚洲a| 亚洲免费精品| 欧美一级日韩一级| 美女日韩欧美| 亚洲精品综合精品自拍| 亚洲综合精品自拍| 久久精品亚洲| 欧美日韩亚洲一区在线观看| 国产精品丝袜久久久久久app| 韩国av一区二区三区在线观看| 91久久精品久久国产性色也91| 夜夜夜精品看看| 久久精品视频在线看| 欧美激情精品久久久久久变态 | 国产综合第一页| 亚洲国产精品高清久久久| 亚洲视频在线一区观看| 久久嫩草精品久久久久| 亚洲国产一成人久久精品| 亚洲在线视频| 欧美va天堂| 亚洲免费小视频| 欧美不卡视频一区| 亚洲一区3d动漫同人无遮挡| 久久久最新网址| 国产精品国产精品国产专区不蜜| 在线成人亚洲| 欧美一区成人| 亚洲欧洲一区二区天堂久久| 亚洲欧美自拍偷拍| 欧美日韩亚洲天堂| 亚洲电影在线看| 欧美一乱一性一交一视频| 亚洲缚视频在线观看| 欧美在线视频观看免费网站| 欧美日韩另类视频| 亚洲国产日韩欧美| 久久激情婷婷| 一本久道久久综合婷婷鲸鱼| 另类专区欧美制服同性| 国产日韩精品在线播放| 在线一区亚洲| 亚洲国产欧美久久| 久久久久久高潮国产精品视| 国产精品嫩草99a| 亚洲私人影院在线观看| 欧美成在线观看| 久久精品国产欧美亚洲人人爽| 国产精品任我爽爆在线播放| 99精品黄色片免费大全| 欧美高清在线| 久久亚洲春色中文字幕久久久| 国产精品成人在线| 一区二区三区日韩| 亚洲日本电影在线| 美女露胸一区二区三区| 在线成人www免费观看视频| 久久国产精品99久久久久久老狼| 中文在线资源观看视频网站免费不卡| 欧美高清视频免费观看| 亚洲国产精品综合| 欧美成人精品激情在线观看| 久久久精品网| 在线看不卡av| 美女免费视频一区| 久久亚洲捆绑美女| 亚洲电影在线播放| 欧美成人小视频| 免费观看成人鲁鲁鲁鲁鲁视频| 在线观看欧美精品| 麻豆精品一区二区av白丝在线| 久久福利精品| 激情自拍一区| 欧美成人精品在线| 欧美aa国产视频| 99re6这里只有精品| 日韩视频免费看| 国产精品久久国产愉拍| 羞羞答答国产精品www一本 | 亚洲国产二区| 亚洲国产一区二区三区高清| 欧美激情精品久久久| 日韩西西人体444www| 99精品国产在热久久| 国产精品麻豆va在线播放| 欧美一区二区三区日韩视频| 欧美一区二区在线视频| 在线成人h网| 最新日韩在线视频| 国产精品久久久久久久午夜| 久久精品国产99国产精品澳门| 久久精品盗摄| 99国产一区| 亚洲一区二区久久| 国内久久婷婷综合| 亚洲国产一区二区三区a毛片| 欧美天天视频| 久久久另类综合| 欧美护士18xxxxhd| 欧美一区二区精品| 久色成人在线| 亚洲欧美日韩在线观看a三区| 欧美一站二站| 夜夜精品视频| 先锋影音久久| 日韩一级在线观看| 午夜久久电影网| 日韩午夜av电影| 欧美专区中文字幕| 亚洲婷婷综合久久一本伊一区| 久久er99精品|