官术网_书友最值得收藏!

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

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.

主站蜘蛛池模板: 鄂伦春自治旗| 沾益县| 鲜城| 南汇区| 石首市| 揭东县| 外汇| 邛崃市| 虎林市| 元阳县| 靖安县| 喀喇沁旗| 博客| 滨州市| 北京市| 襄樊市| 龙江县| 永川市| 龙山县| 六枝特区| 安图县| 安宁市| 察雅县| 伊吾县| 葫芦岛市| 襄垣县| 夏津县| 榕江县| 扬中市| 建始县| 师宗县| 纳雍县| 巴马| 荔波县| 盐源县| 射洪县| 册亨县| 沐川县| 河源市| 永川市| 如东县|