13.理论知识:向量
来源:互联网 发布:mac屏蔽广告插件 编辑:程序博客网 时间:2024/05/14 20:56
13.Theory: Vectors
This post is a bit of theory about vectors, ready for more work onour bus scenario.
这篇帖子介绍一点关于向量的理论,这是为进一步完善巴士游戏剧本做准备。
A lot of the recent posts on this blog (e.g. on drifting, braking) have involved manipulating X and Y speeds. In mathematics, these speeds are termed a two-dimensional vector, written as either (xSpeed, ySpeed), or like this:
这个博客里最近许多帖子(比如漂移,刹车)都涉及到操作x和y方向的速度。在数学里,这样的速度被称为二维向量,记做(xSpeed, ySpeed),或是如下形式:
So if our current speed is 3 in the X direction and -4 in the Y direction, we can write this as (3, -4) or.We saw in the drifting post how to form X and Y speeds that move at a given speed and angle. This can be written in mathematical notation as:
因此如果当前x方向的速度是3而y方向的速度是-4,则我们可以记做(3,-4)或。我们在漂移帖子里了解了如何根据给定的速度和角度值来产生x和y的速度值。这可以写为数学标记:
In fact, it’s so common that all parts of a vector get multiplied by the same number that mathematicians use a notation whereby the number is moved outside the vector — so this is the same as the above:
事实上,由于向量的所有分量都被乘上了相同的数字,因此数学里使用了另一种标记把该相同的数字移到向量的外部——其实这和上面是相同的:
A vector can represent anything where one element is X and one is Y, so it can be a position or a speed or an acceleration.
一个向量可以表示任意事物,其中一个元素是x而另一个是y,因此它可以表示位置、速度或者加速度。
Adding and Splitting Vectors
累加及分解向量
Vectors can be added together, by independently adding their X components together and adding their Y components together. This is easily seen graphically, by joining one vector’s end point to the start point of the next, e.g.
向量可以累加在一起,通过将其x和y分量分别相加得到。用图形的方式很容易明白,比如,通过连接一个向量的终点和另一个向量的起点来相加。
The black vector is added to the red vector, which is equivalent to travelling along the black, then along the red. This adds up to the blue vector. The X component of the blue vector, 6, is the addition of the X component of the black vector (2) and of the red vector (4). Similarly, the Y component of the blue vector, 3, is the addition of the Y component of the black vector (5) and of the red vector (-2).
黑色的向量被累加到红色的向量上,这相当于沿着黑色的向量前进,接着沿着红色的前进。相加的结果形成了蓝色的向量。蓝色向量的x分量6,是黑色向量的x分量(2)和红色向量的x分量(4)的和。类似地,蓝色向量的y分量3,是黑色向量的y分量(5)和红色向量的y分量(-2)的和。
Just as you can add two vectors to make one, you can take one vector and subdivide it into two. The most helpful application of this is in splitting a vector into its X component and Y component:
正如你可以将两个向量累加为一个,你也可以将一个向量分解为两个。最有益的应用是将一个向量分解为其x分量和y分量。
This is quite trivial, but it turns out to often be useful to split the vector this way, as we will see in our next post.
这样做是十分平常的,但是按这种方式分解向量的结果往往是很有用的,我们将在下一篇帖子中看到。
- 13.理论知识:向量
- 理论知识
- 理论知识
- 理论知识
- 【机器学习算法-python实现】svm支持向量机(1)—理论知识介绍
- 病毒理论知识
- 遥感理论知识
- java理论知识
- AOP理论知识
- 网络理论知识
- 博弈论(理论知识)
- hdfs理论知识
- WebService理论知识
- DOM理论知识
- android 理论知识
- Makefile 理论知识
- AJAX理论知识
- IPV4理论知识
- 排序算法之冒泡排序
- Eclipse Debug不为人知的秘密
- MES入门.预备知识.库存
- UIImagePickerController在iPhone和iPad上的区别
- HTML学习之表单传送服务器(简略)
- 13.理论知识:向量
- 关于NFS服务器设定 ——对鸟哥的总结
- ASM Diskgroup Creation Failed with "IBM AIX RISC system/6000: 6:no such device or address" [ID 12634
- 如何截取屏幕图片
- switch knowledge
- 怎样让一个正常人理解“线性代数”
- 14.像巴士一样行驶:在位置基础上添加摩擦力
- ArcGIS Server JavaScript API 学习笔记
- 常用正则表达式验证