3
votes

I was looking over an effect file I found in the DirectX SDK , and the only part that really threw me was the Dot() function. That led me to a Wikipedia page about dot products that made no sense to me. What is a dot product?

1
That's a maths question, rather than programming. math.stackexchange.com/questions/77/… - Orbling
If you want to do graphics programming, you need a pretty solid understanding of geometry. - Orbling

1 Answers

2
votes

It's defined as the sum of scalar products: e.g. for float3 vectors A and B, dot(A,B) is equal to (A.x*B.x + A.y*B.y + A.z*B.z).

dot products are used by HLSL as components of matrix multiplications, and a nice feature of dot(), if both inputs are normalized, is that dot(A,B) will be equal tot he cosine of the angle between the vectors A & B (used a LOT in lighting)