5

I'm learning about vector projection. I understand how to perform it, but I still can't understand what it actually means and what it gives me.

Here is a common definition:

Vector projection of a onto b, gives the component of a that is in the same direction of b.

What does this mean?

Vectors are straight lines. a can't have a part of it in the direction of b and a part of it that isn't. A vector has one direction, it's a straight line.

I just can't understand this. I hope with some help here it'll finally click. Thanks

Willie Wong
  • 75,276
Aviv Cohn
  • 531
  • If you want a really good and broad understanding of what's going on, I recommend you watch this online lecture: http://web.mit.edu/18.06/www/videos.shtml In particular, lectures 14, 15 and 16 are concerned with projections. –  Jun 22 '14 at 11:17

3 Answers3

2

All is in this picture (from wikipedia on Vector Projection) : a1 is the projection of a on b

Vectors are not "lines" they are "segments" that have a direction. A vector is like going from one place to an other. It can gives the following answers : Where does it start, where does it end, which direction is it going and what is the length of it.

The projection would be, I'm walking on trail b (why not a sea trail) where do I stop in the direction of b to be the closest to the end of trail a (like dunno wales eating spot).

This walk you have to make to be the closest is your projection a1 enter image description here

  • Well a vector isn't a segment because they don't describe positions. Your answer, though a nice one, is wrong. A vector is just a set of scalars that are used to form a linear combination of vectors from a set of basis vectors. This is like saying a vector is a length and "direction". – RandyGaul Jun 22 '14 at 12:13
2

vector addition and projection

Although this vector C is indeed a straight line, we see that it can be broken down into these two distinct A and B directions in the sense that C is the result of a vector addition between some length X in the direction of A and some length Y in the direction of B. When we project C onto A, for example, we are finding out what this value of X is.

Ryan
  • 197
1

Usually when we refer to a vector in the context of games programming we mean a "geometric vector". If you really want to understand vectors in their totality eventually you'll need to learn about abstract vector spaces. These are pretty simple, but not so helpful when you're just learning!

I'll stick to calling "geometric vectors" just vectors. A vector has scalar components that represent a direction and length. A vector does not describe position, and has no location. In games vectors are usually used to describe a geometric direction, but can also be used to represent change.

It is important to understand that the Euclidean Basis in 3D is a matrix that looks like this:

[ i 0 0 ]
[ 0 j 0 ]
[ 0 0 k ]

i, j and k are all equal to 1. The Euclidean Basis is the identity matrix. The first column of this matrix represents the x axis. The second column represents the y axis. The third column represents the z axis. This matrix is just a group of three column vectors. Each column is called a basis vector.

A 3D vector has three scalar values and looks like this:

[ x y z ]

What do these three values x, y and z mean? These values represent how far along in the i, j and k directions the vector is composed of. So in reality when we write a 3D vector with x, y and z components, it is a short-hand notation of the following:

[ x * i, y * j, z * k ]

Now remember that i, j and k are column vectors! The above vector can also be written like this:

    [ i ]       [ 0 ]       [ 0 ]
x * [ 0 ] + y * [ j ] + z * [ 0 ]
    [ 0 ]       [ 0 ]       [ k ]

Above, all three column vectors of the Euclidean Basis are being scaled by the components of our 3D vector. This is called a linear combination. Any vector in 3D can be represented by a linear combination of the 3 basis vectors. The above is also the exact computation of multiplying a vector with a matrix! When we write our vectors down we're actually doing short-hand notation of matrix multiplication with the Euclidean Basis.

So when we project vector a onto vector b, we can see how for along the i, j and k directions b travels. We can also check out how far along a travels too. The difference between all of the directions from a and from b can be used to project one vector onto another.

If we want to project a onto b we can subtract away all of a that does not travel in the same direction as b. All that needs to be done is to calculate how far along in the b direction a goes. This last sentence is computed by the dot product.

I recommend reading the book Essential Mathematics by Jim Van Verth to learn all the important math concepts for game programming.

RandyGaul
  • 135