# Very stupid math question

Alright, this is possibly a VERY stupid question, but we just went over the dotproduct in math…exactly WHAT do you get when you take the dotproduct of two vectors? I mean the cross product produces a vector perpendicular to the plan that the other two vectors lay in. That result is easy to visualize. But a dot product does make sense to me. You multiply the components of the two vectors and add them…what does that give you? What is that scalar value represent? It makes even less sense when you use the formula that ab = |a||b|*cos(theta).

I can’t understand what the scalar value represents and how it can be used in graphics.

Thanks to all those who respond.

• Halcyon

The dot product X*Y is the length of the projection of X onto Y.

Most often it is used to find the angle between two vectors. In graphics, normally Y is a normal vector, and the dot product is used in shading (the angle between the light vector and a surface normal) or visibility testing (the angle between viewing vector and a surface normal), for example.

Another useful property is the sign of the dot product:

XY > 0 if theta < 90 degrees
X
Y = 0 if theta = 90 degrees
X*Y < 0 if theta > 90 degrees

So, for backface culling for example, if the dot product between a surface normal and the viewing vector is less than 0, then that face is not visible: greater than 0, it is.

[This message has been edited by rts (edited 11-29-2002).]

[This message has been edited by rts (edited 11-29-2002).]

The dot product of 2 vectors gives you a number that represents how much these vectors point along the same direction (the direction along either of the vectors, your choice, doesn’t matter .

So, when you have 2 vectors, say, a poly’s normal, and maybe a vector that points from a light source to where you specified the normal; the dot product of those 2 vectors tells you how much they line up with eachother.

Now, further, if you normalize the latter, you end up taking the dot product of two normalized vectors. That’s sweet because there’s no magnitudes to care about anymore, and the result is between 0 and 1.