At this point, our candidate vector has a number of surrounding grid vertices, each of which has a normalised Grid Vector, and a Candidate Vector which points to the point.
We want to calculate the dot product between these two vectors. This is a mathematical process to give us a single scalar value from two vectors of any length (as long as the two vectors have the same number of dimensions).
This is a simple computation - just multiply each value against the equivalent value in the other vector and then add them all up:
(vec1.x * vec2.x) + (vec1.y * vec2.y)
Vector A:
Vector B:
Warning - Vector values must be in the range -1 -> 1
Dot Product: