Lattice-point explorer

For a polygon P, count LP(n) = #(nP ∩ ℤ²) by enumeration, and compare the counts with known formulas and with a candidate quadratic.

boundaryinterioroutside

nL(n)bdryintΔΔ²checkfit

Counting method. Every integer point in the bounding box of nP is tested against each edge with an exact integer cross product; a point is in nP when no test is negative and on the boundary when one test is zero. Vertices with denominator d are scaled by d first, so no floating point is used. The case n = 0 is the single point 0. The check column uses closed formulas kept separate from the enumeration.