周一到周五,每天一篇,北京时间早上7点准时更新~

The matrix is not just a Hollywood movie trilogy, but an exceptionally powerful mathematical tool that greatly simplifies the process of solving one or more equations with variables that have complex relationships with one another(矩阵不像东汉书院那样,是个花花肠子,天天想着多圈点粉丝,完了还想兜售课程,还想推广他们自家的引擎,简直是不怀好意, 矩阵它能够让空间位置关系方面的表达得到简化,这么看来,矩阵的确是个好人的说呢。但是比起像柯文哲这样的喜欢把fan念成huan的,东汉书院还是至少逼格高一点的呢). One common example of this, near and dear to the hearts of graphics programmers, is coordinate transformations(矩阵这个同学比较常见的姿势就是坐标的转换). For example, if you have a point in space represented by x, y, and zcoordinates, and you need to know where that point is if you rotate it some number of degrees around some arbitrary point and orientation, you use a matrix(比如,你使用矩阵沿着空间中的某个轴去旋转一个点,你需要知道这个点被转到哪里去了). Why? Because the new x coordinate depends not only on the old x coordinate and the other rotation parameters, but also on what the y and z coordinates were(为什么?因为新的x坐标不仅仅受到原来的x坐标的影响,还会受到原来的y、z坐标的影响). This kind of dependency between the variables and solution is just the sort of problem at which matrices excel(这种类型的变量间的依赖关系刚好是矩阵所能解决的问题). For fans of the Matrix movies who have a mathematical inclination, the term “matrix” is indeed an appropriate title(对于那些有数学功底的***帝国的粉丝来说,毫无疑问matrix确实是一个非常合适的电影名称)

Mathematically, a matrix is nothing more than a set of numbers arranged in uniform rows and columns—in programming terms, a two-dimensional array(数学意义上,矩阵就是很多行列的数据组成一坨东西,在程序员眼里,就是一个二维数组). A matrix doesn’t have to be square, but all of the rows must have the same number of elements and all of the columns must have the same number of elements(一个矩阵不必要非得是方阵,只不过要求每一行或者每一列的元素个数都相同就行). The following are a selection of matrices. They don’t represent anything in particular but serve only to demonstrate matrix structure(下面就是一系列的矩阵,他们不代表任何东西,仅仅是展示了矩阵的结构). Note that it is also valid for a matrix to have a single column or row(矩阵也可能只包含一行或者一列元素). A single row or column of numbers would more simply be called a vector, as discussed previously(如果一个矩阵只有一行或者一列,那么它可以被看成是一个向量). In fact, as you will soon see, we can think of some matrices as a table of column vectors(实际上,你将很快看到,我们可以把矩阵想象成为一个列向量组成的表)

Matrix” and “vector” are two important terms that you see often in 3D graphics programming literature(在3D图形学里,矩阵和向量是非常重要的东西). When dealing with these quantities, you also see the term “scalar.”(当处理这些数据的时候,你经常还会看到标量,一个标量就是一个表达长度的数字或者说什么其他的东西的数据) A scalar is just an ordinary single number used to represent a magnitude or a specific quantity (you know—a regular old, plain, simple number... like before you cared or had all this jargon added to your vocabulary). Matrices can be multiplied and added together, but they can also be multiplied by vectors and scalar values(矩阵间可以进行乘法加法运算,它还可以跟向量和标量进行乘法运算). Multiplying a point (represented by a vector) by a matrix (representing a transformation) yields a new transformed point (another vector)(用点和矩阵相乘可以得到一个转换后的点). Matrix transformations are actually not too difficult to understand but can be intimidating at first(矩阵变换不是非常难理解但是刚接触的玩家会感到很怕怕,如果是这样的话,建议去抓住×××姐的手). Because an understanding of matrix transformations is fundamental to many 3D tasks, you should still make an attempt to become familiar with them(由于理解矩阵任然是你做很多3D工作的基础,所以你还是要克服恐惧,适应这块的数学内容). Fortunately, only a little understanding is enough to get you going and doing some pretty incredible things with OpenGL(幸运的是,只需要小学数学,你就可以玩转OpenGL了). Over time, and with a little more practice and study, you will master this mathematical tool yourself.(随着时间的推移和简单的练习,你就会完全掌握数学工具)

In the meantime, as previously for vectors, you will find a number of useful matrix functions and features available in the vmath library(就如同前面的内容一样,vmath库里也包含了很多可以用于矩阵计算的函数). The source code to this library is also available in the file vmath.h in the book’s source code folder(源代码就在vmath.h里). This 3D math library greatly simplifies many tasks in this chapter and the ones to come(这个3D数学库真的是太棒了,它简化了很多工作以及后面要做得事情,然而感觉这个跟学生学习没什么关系,只是让作者看起来他后面教学内容会简单了). One useful feature of this library is that it lacks incredibly clever and highly optimized code!(一个非常重要的特点就是,这个库的代码很傻,完全没怎么优化过) This makes the library highly portable and easy to understand(这会使得这个库很容易被人理解,以我们的实际经验得到的结果是,没人会去看那些晦涩的代码,尤其是背后有数学理论的时候,即便自己写完都不再愿意看第二遍). You’ll also find it has a very GLSL-like syntax(你会发现它跟GLSL里的语法很像).

In your 3D programming tasks with OpenGL, you will use three sizes of matrices extensively: 2 × 2, 3 × 3, and 4 × 4(在我们的OpenGL里,你将会使用三种不同大小的矩阵,2、3、4维的方阵). The vmath library has matrix data types that match those, defined by GLSL, such as(vmath提供对应的矩阵实现代码,如下所示:)

vmath::mat2 m1;
vmath::mat3 m2;
vmath::mat4 m3;

As in GLSL, the matrix classes in vmath define common operators such as addition, subtraction, unary negation, multiplication, and division, along with constructors and relational operators(就如同GLSL里一样,vmath库定义了基本的矩阵的运算操作的函数接口). Again, the matrix classes in vmath are built using templates and include type definitions for single- and double-precision floating-point, and signed- and unsigned-integer matrix types(同样,该函数是由C++模板实现,你可以使用任意的数据类型,比如浮点、双精度或者是×××都可以的。实际上作为一个大学生或者初级3D图形学选手,你不会去看他的vmath实现, 这些老外写的东西需要你具备牛X的C++基础,才勉强能看懂他们的C++代码,这种是极其不推荐的,学习语言是为了做项目,不是为了使用语言的高级语法,C++学习应该适可而止,重点还是回过头来看图形学。至于3D图形学 方面,我们的建议是如果想深入了解,还是脚踏实地一步一步好好把你的大学工科基础那些书都翻一遍,作者此处纯粹是一笔带过,知识含量有限)

本日的翻译就到这里,明天见,拜拜~~

第一时间获取最新桥段,请关注东汉书院以及图形之心公众号

东汉书院,等你来玩哦

Matrices(矩阵)相关推荐

  1. python与线性代数 矩阵

    1.标量相乘 每个元素与标量相乘 设A,B,CA,B,CA,B,C是相同维数的矩阵,rrr与s" role="presentation" style="posi ...

  2. OpenGL ES着色器语言之变量和数据类型

    所有变量和函数在使用前必须声明.变量和函数名是标识符. 没有默认类型,所有变量和函数声明必须包含一个声明类型以及可选的修饰符.变量在声明的时候首先要标明类型,后边可以跟多个变量,之间用逗号隔开.很多情 ...

  3. Metal之MTLBuffer批量加载顶点数量较多的图形渲染

    渲染原理 本文是基于"Metal渲染绘制三角形"这样顶点较少图形基础之上的延伸, 在渲染三角形的时候, 顶点数据的存储使用的是数组,当顶点传递时通过setVertexBytes(_ ...

  4. 模糊图像处理 去除模糊_图像模糊如何工作

    模糊图像处理 去除模糊 定义 (Definition) Roughly speaking, blurring an image is make the image less sharp. This c ...

  5. R语言第四讲 之R语言数据类型

    基本类型 通常,在使用任何编程语言进行编程时,您需要使用各种变量来存储各种信息. 变量只是保留值的存储位置. 这意味着,当你创建一个变量,你必须在内存中保留一些空间来存储它们. 您可能想存储各种数据类 ...

  6. 《D o C P》学习笔记(3 - 1)Regular Expressions, other languages and interpreters - Lesson 3

    备注1:每个视频的英文字幕,都翻译成中文,太消耗时间了,为了加快学习进度,我将暂停这个工作,仅对英文字幕做少量注释. 备注2:将.flv视频文件与Subtitles文件夹中的.srt字幕文件放到同1个 ...

  7. Metal(一) 三角形绘制

    1.Metal 简介 Metal 是针对 iPhone 和 iPad 中 GPU 编程的高度优化的框架.其名字来源是因为 Metal 是 iOS 平台中最底层的图形框架 (意指 "最接近硬件 ...

  8. 计算机word除法公式,word怎么用函数计算除法

    如何在WORD里用函数计算除? 在word中只能对表格才能使用公式自动求值. 你的Word是2007不?在2007下,可以直接光标定位到成功率位置,然后依次单击"布局,公式",然后 ...

  9. 编程课程学习_如果您想学习数据科学,请从以下编程课程之一开始

    编程课程学习 by David Venturi 大卫·文图里(David Venturi) 如果您想学习数据科学,请从以下编程课程之一开始 (If you want to learn Data Sci ...

  10. r中将数据框中数据类型转化_R中的数据类型

    r中将数据框中数据类型转化 Before we delve deeper into R programming, it is important to understand the various d ...

最新文章

  1. 如何用Python实现超级玛丽的界面和状态机?
  2. ecshop根目录调用_ecshop优化修改sitemap.xml到根目录
  3. silverlight textblock 自动换行
  4. mysql int 11 java_mysql中int(11)列的大小(以字节为单位)是多少?
  5. Class.forName()和ClassLoader.getSystemClassLoader().loadClass()区别
  6. layui下拉框往上显示跟往下显示_牛肉价格持续攀升,潮汕牛肉火锅下月或将调涨了...
  7. 超5000元!骁龙660新机发布:限量供应价格感人
  8. python-简单邮件报警
  9. C# 启动EXE 关闭EXE ProcessStartInfo
  10. JavaWeb知识点复习(第一次)
  11. 香港最卖座的10部华语片:周星驰3部,成龙周润发各自2部
  12. html竖线分割符的特殊符号,网站标题用什么分隔符号
  13. oracle-12514,ORA-12514的解决方法(多图)
  14. CentOS8桌面图标不显示
  15. android x86 uc,UC浏览器X86版下载|UC浏览器X86版老版 V10.8.5 安卓版 下载_当下软件园_软件下载...
  16. idea 一次启动多服务配置
  17. GIS基本功 | 14 地图投影及其相关概念
  18. 在jQuery中,a标签trigger触发click不起作用的原因和解决方法
  19. 外卖派单模拟系统C语言代码,GitHub - Sndav/SuperDeliver: 外卖派单模拟系统大作业
  20. FPGA中LUT设计

热门文章

  1. [转]页面回传与js调用服务器端事件
  2. arm-linux内存页表创建
  3. Trend Micro 趋势科技
  4. 用计算机制作演示文稿教案博客,信息技术:《制作演示文稿的一般过程》教案...
  5. 计算机一级登录密码忘了怎么办,电脑密码忘了怎么办
  6. Java实训——学生信息管理系统
  7. 【k8s系列5】KubernetesClientException: too old resource version 原因分析
  8. 如何发一条九宫格图片的朋友圈
  9. CC2640R2FRSMR低功耗M3内核蓝牙MCU
  10. 打游戏买什么手机好?rog3性能强 网速稳!