Advertisement

Dot product

Started by July 23, 2003 02:14 PM
1 comment, last by Briskon 21 years, 7 months ago
Is the maximum value of the dot product of two noramlized vectors 1? Thanks.
Yup. The maximum dot product of any two vectors is the product of their magnitudes, and normalized vectors, of course, have magnitude 1.


How appropriate. You fight like a cow.
Advertisement
quote:
Original post by Briskon
Is the maximum value of the dot product of two noramlized vectors 1?



In theory yes. But in practice it can give a result > 1 due to FP rounding errors, so if your code depends on it being <= it might fail. For example one common use for the inner product is to find the angle between two vectors, using

angle = acos(dot(vec1, vec2));

But this can crash depending on how the acos function handles values greater than 1.
John BlackburneProgrammer, The Pitbull Syndicate

This topic is closed to new replies.

Advertisement