if it is possible to do this without going through all the entries in the dictionary?
No - Dictionaries store keys as single values. Your values are points. You want to find all items that have a position within a certain distance relative to another value. Since you can't do that without performing some calculation on the key value (and that value is dependent on two properties of the key), there's no way around a dictionary scan.
You could try a structure that enables you to "filter" based on x and y values independently, since you could find all possible x and y values within that distance, and search the collection from there.
Something like a SortedDictionary<int, SortedDictionary<int, Vector2>>
? It may not be as effective for other searches but it would let you easily get values within a certain range of x and y values.
Or use a SortedDictionary
that keys off of one of the coordinates. You'd still have to scan the values to filter by the other coordinate but it would cut your complexity from O(N)
to O(sqrt(N))
I believe (I'm not great on Big-O notation so I could be wrong there)