 Home
 Products
 Integration
 Tutorial
 Barcode FAQ
 Purchase
 Company
create barcode c#.net Figure 711. Moving a triangle on the Y axis in Font
Figure 711. 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.comCode 39 Full ASCII Creator In None Using Barcode drawer for Font Control to generate, create Code 39 image in Font applications. www.OnBarcode.comLet 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.comGenerating EAN13 In None Using Barcode creation for Font Control to generate, create UPC  13 image in Font applications. www.OnBarcode.comCHAPTER 7 s 3D GAME PROGRAMMING BASICS
Barcode Drawer In None Using Barcode creator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comEAN 128 Printer In None Using Barcode generation for Font Control to generate, create GS1 128 image in Font applications. www.OnBarcode.comVertex
PDF417 2d Barcode Creation In None Using Barcode generator for Font Control to generate, create PDF417 2d barcode image in Font applications. www.OnBarcode.comUSPS Confirm Service Barcode Generator In None Using Barcode printer for Font Control to generate, create USPS PLANET Barcode image in Font applications. www.OnBarcode.com1 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.comPrint Data Matrix 2d Barcode In Java Using Barcode creator for Java Control to generate, create Data Matrix image in Java applications. www.OnBarcode.com50 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.comEncode UPC Code In ObjectiveC Using Barcode printer for iPad Control to generate, create Universal Product Code version A image in iPad applications. www.OnBarcode.com10 10 25 Barcode Generation In None Using Barcode creation for Office Word Control to generate, create Barcode image in Word applications. www.OnBarcode.comPaint UPCA In Visual Studio .NET Using Barcode creator for Reporting Service Control to generate, create UPC A image in Reporting Service applications. www.OnBarcode.com0 0 0 Barcode Generation In VB.NET Using Barcode creation for .NET Control to generate, create Barcode image in VS .NET applications. www.OnBarcode.comGenerating 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.comTo 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 UPCA Supplement 2 Creator In .NET Using Barcode encoder for .NET Control to generate, create UPC A image in VS .NET applications. www.OnBarcode.comPainting Barcode In Java Using Barcode creator for BIRT reports Control to generate, create Barcode image in Eclipse BIRT applications. www.OnBarcode.com1 2 3 Barcode Encoder In .NET Using Barcode maker for Visual Studio .NET Control to generate, create Barcode image in .NET applications. www.OnBarcode.comDenso 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.com50 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 712 presents the same operation applied to the first vertex. Figure 712. Applying a matrix multiplication to a 3D 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 3D 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 3D 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 builtin algorithms to multiply matrices, so this multiplication consumes little processing power. Considering that complex 3D 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 3D transformations in your program. All game programming libraries (from OpenGL to DirectX) offer readytouse 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 3D position of the camera, the 3D 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 3D scene is drawn. See Figure 713 to better understand these concepts. Similarly, you have two extra methods, CreatePerspectiveOffCenter and CreatePerspective, which also create matrices for perspective projection, using different parameters.

