View Full Version : Dot Product.......Help

03-06-2003, 10:28 PM
What is the dot product exactly? I hear it's the angle that is created where two vectors meet.

This book has this..........

I am trying to find out if these two are two diferent formulas.

where @="dot"
where %=theta

A @ B= Ax "time" Bx + Ay "times" By


A @ B= |A| @ |B| "times" COS %

Thank you in advance

03-06-2003, 10:28 PM
I mean they are obviously two different formulas but if they do the same thing.

03-06-2003, 10:43 PM

03-06-2003, 11:07 PM
What would be the value of theta? Also......so this is the angle that the vectors make they come together in the end point?

03-06-2003, 11:33 PM

03-07-2003, 08:49 AM
it's the difference between the directions that two vectors point. If two vectors are exactly facing each other the dot product will be -1. If the dot product is 0 the vectors are perpendicular to each other. If the dot product is greater than 0 the two vectors cannot 'see' each other. Some uses for the dot product: lighting in OpenGL (that's why you need surface normals. If the dot product between the surface normal and the vector from the light to the polygon is negative then the polygon is facing the light and its color is calculated accordingly). Anoter use which is similar to the one I described is back face culling. Depending on what settings you have, and what order you draw the vertices, you will again have a surface normal which represents the 'front' of the polygon. If the dot product between the view vector and the surface normal is negative then it gets drawn, otherwise it is facing a completely different directly and does not get drawn.

another equation, similar to yours

cosTheta = A.B / ||A|| ||B||