On a two dimensional graph there exists two points $p=(x_1,y_1)$ and $d=(x_2,y_2)$. In order to get from point $p$ to point $d$, you must only use vectors that have a length of $\sqrt{1^2 + 2^2}=\sqrt5$ and a slope of either $\pm2$ or $\pm\frac12$.
How can I figure out the minimum number of vectors needed to connect the two points?
A vector with slope $\pm2$ is of the form $(c,\pm2c)$ while one while slope $\frac12$ is of the form $(2c,\pm c)$. In either case, the magnitude is $\sqrt{c^2+4c^2}=|c|\sqrt{5}$, so we're restricted to $c=\pm 1$. Hence, our possible moves are
$$(\pm 1, \pm 2)\\ (\pm 2, \pm 1)$$
where choice of signs for each coordinate are independent. In particular, if $p-d\not\in\mathbb{Z}^2$ we cannot ever reach one from the other with the allowed moveset.
Proof: Notice that
$$(1,0)=(1,-2)+(-2,1)+(2,1)$$
and observe that it is not possible to make $(1,0)$ with less than three moves. Indeed, each move changes the parity of the difference of coordinates, so we must have an odd number of moves. Clearly, one move will not suffice.
Similarly, we can obtain $(-1,0)$ and $(0,\pm1)$, which generate all of $\mathbb{Z}^2$.$\square$
Now, of course we can generally do better than that. For instance, we can write
$$(2,0)=(1,2)+(1,-2)$$
(and similarly for other signs) to obtain that if $p-d\in2\mathbb{Z}^2$, then we can reach one from the other in $|a|+|b|$ moves or less.
Combining this with our expression for $(1,0)$, we conclude that if $a\equiv 0$ and $b\equiv 1$ modulo $2$ (or vice versa), then we can get from $p$ to $d$ in $|a|+|b|+2$ moves or less.
Still, in all of these cases, we're "wasting displacement" when we cancel out signs in the expressions for $(1,0)$ and $(2,0)$, so we should look for an algorithm that refines this.
Initially, we are at $r=(0,0)$ and we wish to get to $s=$ $(a,b)$, but we will rather think this as going from $s$ to $r$ (they're equivalent). One idea is as follows: calculate the shortest path for a few points $s$ close to the origin, and store them.
Now, if $s$ is "large" -- outside of the "stored ball" around the origin --, we choose a move $v$ such that $u=s+v$ minimizes $\lVert s\rVert$, and set $s:=u$.
Finally, we simply repeat this until $s$ enters our stored ball, at which point we proceed via the corresponding stored shortest path.
Why not simply 'always minimize $\lVert s\rVert$'? If you try it with $(1,0)$, you should find out why -- we end up in a loop! This is because of specific 'oddities' for the shortest path near the origin.
In fact this answer contains the following image, which very visually shows how the patterns that can be found for large $s$ break down when we approach the origin:
You can use the image above to deduce a formula for the number $n$ of steps in the shortest path, but in any case you can also find it in this answer.
For the sake of completeness, I will write it here. Let $C_1=\{(\pm1,0),(0,\pm1)\}$, $C_2=\{(\pm2,\pm2)\}$ (where choice of signs for each coordinate is independent) and $C=C_1\cup C_2$. Then
$$n(a,b)=\left\{ \begin{array}{cccl} 3&&&\text{if $(a,b)\in C_1$}\\ 4&&&\text{if $(a,b)\in C_2$}\\ (a-b)-2\left\lfloor\frac{a-2b}{3}\right\rfloor&&&\text{if $(a,b)\not\in C$ and $a<2b$}\\ (a-b)-2\left\lfloor\frac{a-2b}{4}\right\rfloor&&&\text{otherwise} \end{array} \right.$$