实例介绍
3D游戏与计算机图形学中的数学方法 Mathematics for 3D Game Programming and Computer Graphics (3rd Edition) 作者最新关于游戏开发书籍第一卷
Preface Chapter 1 Vectors and Matrices 1.1 Vector fundamentals 1.2 Basic Vector Operations 1.2.1 Magnitude and Scalar Multiplication 1. 2. 2 Addition and Subtraction 8 1. 3 Matrix Fundamentals 1. 4 Basic Matrix Operations 16 1.4. 1 Addition, Subtraction, and Scalar multiplication 16 1.4.2 Matrix Multiplication 1.5 Vector Multiplication 1.5.1 Dot Product 20 1.5.2 Cross Product 24 1.5.3 Scalar Triple product 30 1.6 Vector Projection 1.7 Matrix Inversion 36 I.7. 1 Identity Matrices 36 1.7.2 Determinants 37 1.7.3 Elementary Matrices 1.7.4 Inverse calculation 45 1.7.5 Inverses of small matrices Exercises for Chapter 1 51 Contents Chapter 2 Transforms 55 2.1 Coordinate Spaces 55 2.1.1 Transformation matrices 56 2. 1.2 Orthogonal Transforms 57 2. 1.3 Transform Composition 58 2.2 Rotations 59 2.2.1 Rotation about a coordinate axis 59 2.2.2 Rotation About an arbitrary Axis 62 2.3 Reflections 65 2.4 Scales 69 2.5 Skews 71 2.6 Homogeneous Coordinates 2.7 Quaternions 82 2.7.1 Quaternion Fundamentals 82 2.7.2 Rotations With Quaternions 87 Exercises for Chapter 2 95 Chapter 3 Geometry 97 3. 1 Triangle Meshes 97 3.2 Normal vectors 99 3.2.1 Calculating Normal Vectors 99 3.2.2 Transforming Normal Vectors 102 3.3 Lines and rays 107 3.3.1 Parametric Lines 107 3.3.2 Distance between a point and a line 108 3,3,3 Distance between two lines 110 3.4 Planes l12 3.4.1 Implicit planes 113 3. 4.2 Distance between a point and a plane 115 3.4.3 Reflection Through a plane 117 3.4.4 Intersection of a line and a plane 119 3.4.5 Intersection of Three planes 120 3.4.6 Intersection of two planes 122 3.4.7 Transforming Planes 124 Contents 3.5 Plucker Coordinates 125 3.5.1 Implicit Lines 126 3.5.2 Homogeneous Formulas 128 3.5.3 Transforming lines 132 Exercises for Chapter 3 134 Chapter 4 Advanced algebra 137 4.1 Grassmann Algebra 138 4.1.1 Wedge product 138 4.1.2 Bivectors 139 4.1. 3 Trivectors 142 4.1.4 Algebraic Structure 143 4.1.5 Complements 149 4.1.6 Antivectors 153 4.1.7 Antiwedge Product 155 4.2 Projective Geometry 159 4.2.1 Lines 159 4.2.2 Planes 160 4.2.3 Join and meet 162 4.2.4 Line Crossing 163 4.2.5 Plane distance 165 4.2.6 Summary and Implementation 166 4.3 Matrix Inverses 170 4.4 Geometric algebra 173 4.4.1 Geometric Product 174 4.4.2 Vector Division 176 4.4.3 Rotors 178 4.5 Conclusion 181 Exercises for Chapter 4 182 Index 185 Preface This book provides a detailed introduction to the mathematics used by modern game engine programmers. The first three chapters cover the topics of linear al- gebra(vectors and matrices), transforms, and geometry in a conventional manner common to many other textbooks on the subject. This is done to provide a famil- iarity with the usual approach so that its easy to make connections to similar expositions of the same topics elsewhere in the literature. Along the way, we will make several attempts to foreshadow the discussion of a manifestly more elegant and more correct mathematical model that appears in the fourth chapter. The last quarter of the book endeavors to provide a deeper understanding of many of the concepts discussed earlier by introducing Grassmann algebra and geometric al- gebra. Knowledge of these branches of mathematics also allows us to convey intuition and provide details in the first three chapters that are difficult to find any where else One of the goals of this book is to give practical engineering advice. This is accomplished through many short code listings appearing throughout the book showing how the mathematics we've discussed is implemented inside real-world game engines. To avoid filling pages with code listings that are illustratively re dundant, some data structures or functions referenced in various places have in tentionally been left out. This happens only when the form and behavior of the missing code is obvious. For example, Chapter 1 includes code listings that de fine a data structure and operations corresponding to a three-dimensional vector but it doesn't show similar code for a four-dimensional vector, even though it's used by other code listings later in the book, because it would be largely identi- cal. The complete library of code is available on the website cited below Preface We assume that the reader has a solid understanding of basic trigonometry, a working knowledge of the C++ language, and some familiarity with standard floating-point numbers. a bit of calculus appears in Chapter 3 but a full grasp of this isolated usage is not essential to the rest of the book. Otherwise all of the mathematics that we cover is built from the ground up. Advanced readers pos- sessing a thorough knowledge of linear algebra may wish to skip much of the first two chapters. However, we recommend that all readers take a look at Chap ter 3 before proceeding to the final chapter because Chapter 4 assumes a familiar- ity with the notation and conceptual details discussed in Chapter 3 Important equations and key results appearing in the text are boxed with a blue outline. This is intended both to highlight the most valuable information and to make it easier to find when using the book as a reference Each chapter concludes with a set of exercises, and many of those exercises ask for a short proof of some kind. The exercises are designed to provide addi- tional educational value, and while many of them have easy solutions, others are a little trickier. To ensure that getting stuck doesn't deprive any reader of a small but interesting mathematical revelation, the answers to all of the exercises are provided on the website cited below. This book is the first volume in a series that covers a wide range of topics related to game engine development. The official website for the Foundations of Game Engine Development series can be found at the following address foundationsofgameenginedev.com This website contains information about all of the books in the series, including announcements, errata, code listings, and answers to exercises Preface Acknowledgements The first volume was made possible by a successful crowdfunding campaign, and the author owes a debt of gratitude to the hundreds of contributors who supported the Foundations of game Engine Development series before even a single word was written. Special thanks go to the following people in particular for showing extra support by making contributions that exceed the cost of a copy of the book Alexandre abreu Trevor green Norbert Nopper Luis alvarado Nicolas guillemot Nikolaos patsiouras Kelvin arcelay Mattias gunnarsson Georges Petryk Daniel archard Aaron gutierrez lan prest Robert beckebans Timothy Heldna Mike Ramsey Andrew bell Andres hernandez Darren ranall Andreas bergmeier Hauke hildebrandt Steen rasmussen Marco bouterse James huntsman Guarneri rodolphe Lance burns Martin hurton Yuri Kunde schlesner Daniel care Francois Jaccard Bill Seitzinger Bertrand Carre Martin Joosten Michael d. shah Ignacio Castano aguado Tonci jukic Brian Sharp Soren christensen Tim Kane Sean slavik Daniel collin Soufiane khiat Daniel smith Vicente Cuellar Hyuk Kim Soufi souaiaia Courtois damien Youngsik kim Tiago Sousa Paul demeulenaere Christopher Kingsley Aaron Spehr Francois devic Kieron Lanning Justin Squire Jean-Francois dube Kwon-il Lee Tim stewart Ashraf eassa Jean-Baptiste Lepesme Runar Thorstensen Wolfgang Engel William leu Joel de vahl Fredrik Engkvist Shaochun li LarsⅤ eklund Brandon Fogerty Yushuo liu Ken voskuijl Jean-Francois F Fortin Yunlong Ma Shawn walker-salas Nicholas francis Brook miles lan Whyte Marcus fritzsch Javier moya perez Graham Wihlidal Taylor Gerpheide Michael Myles Nicholas Gildea Dae Myung Chapter Vectors and Matrices Vectors and matrices are basic mathematical building blocks in the field of linear algebra. They show up in the development of game engines practically every where and are used to describe a wide array of concepts ranging from simple points to projective coordinate transformations. The importance of acquiring a strong intui- tion for vector mathematics and mastering the fundamental calculations that are involved cannot be overstated because a great number of game engine topics inescapably depend on these skills. With this in mind, we begin at the earliest possible starting point and build from the ground up with a thorough introduction that assumes only an existing proficiency in trigonometry on the part of the reader 1.1 Vector Fundamentals Traditionally, basic numerical quantities arising in geometry, physics, and many other fields applied to virtual simulations fall into two broad categories called sca- lars and vectors. A scalar is a quantity such as distance, mass, or time that can be fully described using a single numerical value representing its size, or its magni- tude. A vector is a quantity that carries enough information to represent a direction in space in addition to a magnitude, as described by the following examples The difference between two points contains information about both the dis tance between the points, which is the magnitude of the vector, and the direc- tion that you would need to go to get from one point to the other along a straight Ine The velocity of a projectile at a particular instant is given by both its speed( the magnitude) and the direction in which it is currently travelling Chapter 1 Vectors and Matrices A force acting on an object is represented by both its strength(the magnitude) and the direction in which it is applied In n dimensions, a direction and magnitude are described by n numerical co ordinates, and these are called the components of a vector. When we want to write down the complete value of a vector, we often list the components inside paren- theses. For example, a three-dimensional vector v having components l, 2, and 3 Is written as v=(l,2,3) We follow the common practice of writing vectors in bold to distinguish them from scalars, which are written in italic. We identify an individual component of a vector v by writing a zero-based subscript such that vo means the first component, V, means the second component, and so on. Notice that we write the vector itself in italic in these cases because the component that were talking about is a scalar quantity. USing this notation, an n-dimensional vector v can be written as Beginning with a subscript of zero for the first component is a departure from the usual convention in purely mathematical circles, where the subscript for the first component is typically one. However, zero-based indices are a much better fit for the way in which computers access individual fields in data structures, so we use the zero-based convention in this book to match the values that would actually be used when writing code The meaning of a vector's components depends on the coordinate system in which those components are expressed It is usually the case that we are working in Cartesian coordinates, and this being the case, the numbers making up a three dimensional vector are called the x, y, and z components because they correspond to distances measured parallel to the x y, and z axes. (In two dimensions, the third component doesn't exist, and we have only the x and y components) In addition to numerical subscripts, we can identify the components of a vector v using labels that correspond to the coordinate axes. In three dimensions, for ex- ample, we often write (vr, vy, V2), where it's understood that each subscript is to be interpreted only as a label and not as a variable that represents an index If we want to equate the components to their values, then using the example in Equation(1. 1), we can write them as 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论