vec_dot_product - calculate the dot product of two vectors |
#include <matvec.h> float vec_dot_product (const float *v1, const float *v2); |
vec_dot_product calculates the dot product of two vectors v1 and v2 and returns it. The dot product is formally defined as: |
|v1| |v2| cos theta |
where theta is the angle between the two vectors. |
One interesting consequence of this is that if both v1 and v2 are already normalized, then the dot product is 1 if the vectors are parallel and running in the same direction, and 0 if the vectors are perpendicular. |
Richard Jones <rich@annexia.org> |
GNU LGPL (see http://www.gnu.org/) |
c2lib-1.2.13 |
vec_magnitude_in_direction(3), vec_angle_between(3) |