3Д БУМ

3Д принтеры и всё что с ними связано

Using and Understanding Vectors

You know all about matrices now, so you can move on to the second concept, vectors. Vectors are one-dimensional arrays of numbers. In 3D graphics and games, most vectors have two, three, or even four compo­nents, one for each axis, but a vector can have as many components as needed. They can be used to represent locations, hold the direction and

1

0

0

tx

sx

0

0

o’

0

1

0

ty

0

sy

0

0

0

0

1

tz

0

0

sz

0

0

0

0

1

0

0

0

1

Translation Scaling

Figure 1.14 The translation and scaling matrices. The translation matrix contains an ordered pair for movement along the X, Y, and Z axes; the scaling matrix contains an ordered pair for scaling along the X, Y, and Z axes.

speed of movement of an object, and are used extensively when working with physics in 3D games.

A vector has both a magnitude and a direction. On paper, a vector can be drawn as an arrow. The length of the vector is its magnitude, and the arrowhead indicates the direction of the vector. In physics, you can represent the velocity of an object. The arrow points toward the direction the object was heading, and the length of the arrow indicates its speed. Figure 1.15 shows several examples of vectors.

Using and Understanding Vectors

Figure 1.15 A few vectors, each having its own magnitude and direction, on a two-dimensional graph. 2D, 3D, and 4D vectors are used extensively through game programming to represent character positions and movements, calculate how an object will react in an environment (physics), even store lighting information.

Для любых предложений по сайту: [email protected]