Your ideea is very nice,I thought about it
so if we take $d=2 then the radius which in this case is $d/2=1
so now we can have the formula ($x-1)**2 + ($y-1)**2 <= 1
exactly as you write in your comment.
About the difference between $x*$x and $x**2,what optimisations do you think could be
made ?