You already know how to access elements of the vector; we can see it from your code — using the operator '[]'. As to the distance, this is the distance in the
metric space, in this case — Euclidean:
http://en.wikipedia.org/wiki/Euclidean_space#Distance[
^],
http://en.wikipedia.org/wiki/Euclidean_distance[
^].
Which part of it could be a problem?
[EDIT]
And did you get the comment to the question by Philippe Mori. He is right: you are taking the mouse location well too fast, event when the location is not changed. This is completely pointless. You need to do it in the handler of the
WM_MOUSEMOVE
Windows message (for Windows OS). How to handle it, depends on the UI library you are using; you can do it even using raw Windows API.
—SA