Lattice points inside non-lattice polygon
For lattice polygons there is Pick's formula to enumerate the lattice points inside the polygon. What about polygons with arbitrary vertices?
Let's process each of the polygon's edges individually, and after that we may sum up the amounts of lattice points under each edge considering its orientations to choose a sign (like in calculating the area of a polygon using trapezoids).
First of all we should note that if current edge has endpoints in and then it can be represented as a linear function:
Now we will perform a substitution so that . This allows us to work with and . Let's denote .
We will not sum up points at and on for the integrity of the algorithm. They may be added manually afterwards. Thus we have to sum up . We also assume that and . Otherwise one should substitute and add to .
Let's discuss how we can evaluate a sum . We have two cases:
or .
Then we should start with summing up points below . Their amount equals to
Now we are interested only in points such that . This amount is the same as the number of points such that . So we reduced our problem to , and both and less than now. Here is a picture, we just summed up blue points and subtracted the blue linear function from the black one to reduce problem to smaller values for and :

and .
If equals , we can safely return . If this is not the case, we can say that there are no lattice points such that and . That means that we will have the same answer if we consider new reference system in which , axis is directed down and axis is directed to the left. For this reference system we are interested in lattice points on the set
which returns us back to the case . You can see new reference point and axes and in the picture below:

As you see, in new reference system linear function will have coefficient and its zero will be in the point which makes formula above correct.
Complexity analysis
We have to count at most points. Among them we will count on the very first step. We may consider that is negligibly small because we can start with making it less than . In that case we cay say that we count about of all points. Thus we will finish in steps.
Implementation
Here is simple function which calculates number of integer points such for and :
int count_lattices(Fraction k, Fraction b, long long n) {
auto fk = k.floor();
auto fb = b.floor();
auto cnt = 0LL;
if (k >= 1 || b >= 1) {
cnt += (fk * (n - 1) + 2 * fb) * n / 2;
k -= fk;
b -= fb;
}
auto t = k * n + b;
auto ft = t.floor();
if (ft >= 1) {
cnt += count_lattices(1 / k, (t - t.floor()) / k, t.floor());
}
return cnt;
}Here Fraction is some class handling rational numbers.
On practice it seems that if all denominators and numerators are at most by absolute value then in the recursive calls they will be at most if you keep dividing numerators and denominators by their greatest common divisor.
Given this assumption we can say that one may use doubles and require accuracy of where is accuracy with which and are given.
That means that in floor one should consider numbers as integer if they differs at most by from an integer.