\$d(v)=\sqrt{v_x^2 + v_y^2}\$
Or as code:
The code you've described uses the Manhattan distance metric:
\$d_T(v)= \vert v_x\vert\ + \vert v_y \vert \$
Or as code:
Euclidean Manhattan
sqrt(v.x*v.x + v.y * v.y) abs(v.x) + abs(v.y)
sqrt(1 * 1 + 1 * 1) abs(1) + abs(1)
sqrt(2) 1 + 1
1.414... 2
$$\begin{array}{cc} \mathrm{Euclidean} & \text{ }& \text{vs. } & \mathrm{Manhattan} \\ \sqrt{v_x^2 + v_y^2} & & & \vert v_x\vert\ + \vert v_y \vert \\ \sqrt{1^2 + 1^2} & & & \vert 1\vert\ + \vert 1 \vert \\ \sqrt{2} & & & 1 + 1\\ 1.414\dotsc & & & 2\\ \end{array}$$
Our familiar Euclidean metric is the red circle. This is the set of all points x,y\$x,y\$ such that x^2 + y^2 = 1\$x^2 + y^2 = 1\$. You can see that it's rotationally-symmetric, and that's why we like it: it neatly represents the idea that distance doesn't change with direction.
Finally, I threw in the Chebyshev metric for fun - it's the green square:
\$d_{Chebshev}(v) = \text{max} (\vert v_x\vert, \vert v_y \vert)\$
Or as code:
It's also good for tile-based games, where you're allowed to move on diagonals. A Kingking in Chesschess moves according to the Chebyshev metric.
