If I have points a rectangular lattice such that each point takes the form of $(a+bi,c+dj)$ with $i,j\in \Bbb Z$ (for some given $a,b,c,d\in\Bbb Z$), and $b,d>0$. How can I find the number of visible points(Meaning that the line between the point and the origin contains no other points of the form previously mentioned) which are less than or equal to $r$ distance of the origin? I was looking through some articles on lattice visibility and couldn't find anything about rectangular lattices(Although I may just not have understood when they were discussing them) If anyone has a link to a paper which talks about this that would be great, or a solution would be amazing.
For context I'm trying to find the solution for this when there are 4 of these rectangular lattices overlaid on each other such that the points take the form $(\pm a+bi, \pm c+dj)$
EDIT: I'm writing an algorithm to solve this, and $O(N^2)$(ish) is either too slow, or there's a very weird edge case I'm not realizing
EDIT 2: here's an example where $r = 4$, so even though the point (4,0) is within range of the green dot, its on the same line as (1,0) so it wouldn't be counted. The red lines in the example are too long. example