create barcode c#.net Figure 7-11. Moving a triangle on the Y axis in Font

Creation ECC200 in Font Figure 7-11. Moving a triangle on the Y axis

Figure 7-11. Moving a triangle on the Y axis
Drawing Data Matrix ECC200 In None
Using Barcode maker for Font Control to generate, create ECC200 image in Font applications.
www.OnBarcode.com
Code 39 Full ASCII Creator In None
Using Barcode drawer for Font Control to generate, create Code 39 image in Font applications.
www.OnBarcode.com
Let s assume that the coordinates of the triangle vertices are as follows:
Drawing QR Code In None
Using Barcode creation for Font Control to generate, create Quick Response Code image in Font applications.
www.OnBarcode.com
Generating EAN13 In None
Using Barcode creation for Font Control to generate, create UPC - 13 image in Font applications.
www.OnBarcode.com
CHAPTER 7 s 3-D GAME PROGRAMMING BASICS
Barcode Drawer In None
Using Barcode creator for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
EAN 128 Printer In None
Using Barcode generation for Font Control to generate, create GS1 128 image in Font applications.
www.OnBarcode.com
Vertex
PDF-417 2d Barcode Creation In None
Using Barcode generator for Font Control to generate, create PDF-417 2d barcode image in Font applications.
www.OnBarcode.com
USPS Confirm Service Barcode Generator In None
Using Barcode printer for Font Control to generate, create USPS PLANET Barcode image in Font applications.
www.OnBarcode.com
1 2 3
Data Matrix 2d Barcode Creator In None
Using Barcode maker for Software Control to generate, create Data Matrix image in Software applications.
www.OnBarcode.com
Print Data Matrix 2d Barcode In Java
Using Barcode creator for Java Control to generate, create Data Matrix image in Java applications.
www.OnBarcode.com
50 70 55
Encoding Code 128 In Visual Basic .NET
Using Barcode printer for .NET Control to generate, create USS Code 128 image in .NET applications.
www.OnBarcode.com
Encode UPC Code In Objective-C
Using Barcode printer for iPad Control to generate, create Universal Product Code version A image in iPad applications.
www.OnBarcode.com
10 10 25
Barcode Generation In None
Using Barcode creation for Office Word Control to generate, create Barcode image in Word applications.
www.OnBarcode.com
Paint UPCA In Visual Studio .NET
Using Barcode creator for Reporting Service Control to generate, create UPC A image in Reporting Service applications.
www.OnBarcode.com
0 0 0
Barcode Generation In VB.NET
Using Barcode creation for .NET Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
Generating QR Code ISO/IEC18004 In None
Using Barcode maker for Online Control to generate, create QR Code JIS X 0510 image in Online applications.
www.OnBarcode.com
To translate 40 units over the Y axis s positive direction, all you need to do is to sum 40 to each Y position, and you have the new coordinates for the vertices, shown here: Vertex
UPC-A Supplement 2 Creator In .NET
Using Barcode encoder for .NET Control to generate, create UPC A image in VS .NET applications.
www.OnBarcode.com
Painting Barcode In Java
Using Barcode creator for BIRT reports Control to generate, create Barcode image in Eclipse BIRT applications.
www.OnBarcode.com
1 2 3
Barcode Encoder In .NET
Using Barcode maker for Visual Studio .NET Control to generate, create Barcode image in .NET applications.
www.OnBarcode.com
Denso QR Bar Code Drawer In Visual C#.NET
Using Barcode creation for .NET Control to generate, create Quick Response Code image in Visual Studio .NET applications.
www.OnBarcode.com
50 70 55
50 50 65
0 0 0
You can achieve the same results by representing each vertex as a matrix with one row and four columns, with the vertex coordinates as the first three columns and one as the value in the last one. You then multiply this matrix to a special matrix, constructed to produce the translation transformation to the vertex matrix. Figure 7-12 presents the same operation applied to the first vertex.
Figure 7-12. Applying a matrix multiplication to a 3-D vertex
A little explanation about multiplication for matrices: to calculate the resulting matrix, you must take each value in the row of the first matrix, multiply them by each of the values in the corresponding column in the second matrix, and then perform the sum of all results. So, in the previous sample, the calculations are as follows: x' = (50 ! 1) + (10 ! 0) + (0 ! 0) + (1 ! 0) = 50 y' = (50 ! 0) + (10 ! 1) + (0 ! 0) + (1 ! 40) = 50 z' = (50 ! 0) + (10 ! 0) + (0 ! 1) + (1 ! 0) = 0
CHAPTER 7 s 3-D GAME PROGRAMMING BASICS
We don t want to get into much more detail here. It s enough to say that you can perform translations by putting the desired values for translation over the X, Y, and Z in the last row of the transformation matrix. You can perform scaling by replacing the 1s on the diagonal with fractional values (to shrink) or values bigger than 1 (to expand), and perform rotation around any axis using a combination of sine and cosine values in specific positions in the matrix. So, what s the big deal about using matrices One of the biggest benefits is that you can perform complex operations by multiplying their corresponding transformation matrices. You can then apply the resulting matrix over each vertex on the 3-D model, so you can perform all operations over the model by multiplying its vertices for only one matrix, instead of calculating each transformation for each vertex. Better than that: all graphics cards have built-in algorithms to multiply matrices, so this multiplication consumes little processing power. Considering that complex 3-D objects may have thousands of vertices, doing the transformations with as low a processing cost as possible is a must, and matrices are the way to do this. Luckily enough, you don t need to understand all these mathematical details to use matrices and execute 3-D transformations in your program. All game programming libraries (from OpenGL to DirectX) offer ready-to-use matrix manipulation functions, and XNA is no exception. Through the Matrix class, many matrix operations are available, such as the following: Matrix.CreateRotationX, Matrix.CreateRotationY, and Matrix.CreateRotationZ: Creates a rotation matrix for each of the axes. Matrix.Translation: Creates a translation matrix (one or more axes). Matrix.Scale: Creates a scale matrix (one or more axes). Matrix.CreateLookAt: Creates a view matrix used to position the camera, by setting the 3-D position of the camera, the 3-D position it is facing, and which direction is up for the camera. Matrix.CreatePerspectiveFieldOfView: Creates a projection matrix that uses a perspective view, by setting the angle of viewing ( field of view ), the aspect ratio (see the following note), and the near and far plane, which limit which part of the 3-D scene is drawn. See Figure 7-13 to better understand these concepts. Similarly, you have two extra methods, CreatePerspectiveOffCenter and CreatePerspective, which also create matrices for perspective projection, using different parameters.
Copyright © OnBarcode.com . All rights reserved.