- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 199字
- 2021-06-30 14:45:49
Introducing vectors
What is a vector? A vector is an n-tuple of numbers. It represents a displacement measured as a magnitude and a direction. Each element of a vector is usually expressed as a subscript, such as (V0, V1, V2, … VN). In the context of games, vectors usually have two, three, or four components.
For example, a three-dimensional vector measures displacement on three unique axes: x, y, and z. Elements of vectors are often subscripted with the axis they represent, rather than an index. (VX, VY, VZ) and (V0, V1, V2) are used interchangeably.
When visualizing vectors, they are often drawn as arrows. The position of the base of an arrow does not matter because vectors measure displacement, not a position. The end of the arrow follows the displacement of the arrow on each axis.
For example, all of the arrows in the following figure represent the same vector:

Figure 2.1: Vector (2, 5) drawn in multiple locations
Each arrow has the same length and points in the same direction, regardless of where it is positioned. In the next section, you will start to implement the vector structure that will be used throughout the rest of this book.
- Mastering Ext JS(Second Edition)
- 少兒人工智能趣味入門:Scratch 3.0動(dòng)畫與游戲編程
- Java逍遙游記
- JIRA 7 Administration Cookbook(Second Edition)
- Spring Boot+Spring Cloud+Vue+Element項(xiàng)目實(shí)戰(zhàn):手把手教你開發(fā)權(quán)限管理系統(tǒng)
- Instant 960 Grid System
- Data Analysis with IBM SPSS Statistics
- Python高效開發(fā)實(shí)戰(zhàn):Django、Tornado、Flask、Twisted(第3版)
- Python數(shù)據(jù)可視化之Matplotlib與Pyecharts實(shí)戰(zhàn)
- 軟件架構(gòu):Python語言實(shí)現(xiàn)
- ASP.NET開發(fā)與應(yīng)用教程
- Mastering Data Mining with Python:Find patterns hidden in your data
- 實(shí)戰(zhàn)Python網(wǎng)絡(luò)爬蟲
- Python數(shù)據(jù)預(yù)處理技術(shù)與實(shí)踐
- SCRATCH編程課:我的游戲我做主