{"id":51,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/the-cd-s-code\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"the-cd-s-code","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/the-cd-s-code\/","title":{"rendered":"The CD\u2019s Code"},"content":{"rendered":"

Take a look at the following directory on the CD: \/Code\/Chapterl\/ or \/Code\/Math. Here, you will find C++ classes to store and manipulate matrices and vectors. There are separate classes for 3×3 and 4×4 matrices, both defined and implemented in the files matrix. cpp and matrix. inl. The same goes for vectors. There are classes for both 2D and 3D vectors, defined and implemented in vector. h and vector. inl. All of the classes contain a variety of functions to perform the opera\u00adtions covered here, as well as overloaded operators that can be used to do the basic mathematical operations such as addition and subtrac\u00adtion. There are even operators to compare two matrices or vectors and tell you if they are equal. All these operators allow you to use matrices and vectors as if you were just using real numbers. Syntax such as vectorl = vector2 + vector3 and if(matrix1 == matrix2) are both valid thanks to the wonderful features of C++ that allow programmers to override the default definition of the mathematical operators.<\/p>\n

In both directories you will notice a few extra files, as follows:<\/p>\n

■ math. h is the main header file that basically includes all of the other files, ensuring that you get all of the functionality avail\u00adable, without needing to remember to include a bunch of files.<\/p>\n

<\/p>\n\n\n
\n

\"The<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n

■ The other two files, quaternion. h and quaternion. inl, are the definitions and implementation of a class that is used to store and manipulate quaternions, which you will be learning about in the next chapter. There are a few functions in the matrix and vector classes that use quaternions, generally signified by taking either a reference to a CQuaternion class as a parameter, or return\u00ading a CQuaternion class. Don\u2019t panic if you don\u2019t know what these functions are for; you will learn about them in the next chapter.<\/p>\n

Conclusion<\/a><\/p>\n

That concludes the brief review of matrix and vector math. If you need or want to learn more about either, I suggest that you visit a local college library or bookstore and pick yourself up a book on linear algebra. The books I used as a reference for most of this were Matrices, written by Frank Ayres Jr. and Linear Algebra, by the same author. Both are part of a series of math references known as Schaum\u2019s Outlines Series of Mathematics. If you cannot afford a book, or simply want a different solution, I once again suggest Eric Weisstein\u2019s World of Math\u00adematics, available at http:\/\/mathworld. wolfram. com<\/a>. Eric Weisstein\u2019s World of Mathematics has examples and explanations for many mathematical problems, including matrices and vectors.<\/p>\n

The next chapter introduces you to quaternions. Quaternions are used by graphics programmers to represent rotations, much like a 3×3 rotation matrix. However, quaternions hold several advantages over traditional matrices, such as the capability to avoid gimbal lock, and the capability to create easy, smooth interpolation between orientations.<\/p>\n

To top it all off, they take up less space than matrices. Check it out!<\/p>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

Take a look at the following directory on the CD: \/Code\/Chapterl\/ or \/Code\/Math. Here, you will find C++ classes to store and manipulate matrices and vectors. There are separate classes for 3×3 and 4×4 matrices, both defined and implemented in the files matrix. cpp and matrix. inl. The same goes for vectors. There are classes […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/51"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}