Pick's Theorem

Draw a lattice polygon, count its interior and boundary points and check Pick’s area formula.

About this tool

Click grid intersections in boundary order, or drag the white vertex handles. The polygon closes automatically; counts and area update immediately. Blue points are strictly inside, amber points lie on the boundary. White handles mark the vertices. One grid step is one arbitrary length unit; area uses its square.

Interior I and boundary B are enumerated with an independent winding test. Area A is calculated separately with the shoelace formula. Open Coordinates to compare the numeric equality I + B/2 − 1 = A or edit one integer x y pair per line. A repeated closing vertex is optional. Raw coordinate text, including unfinished input, restores on reload; results, cursor and interaction state are not stored.

New clears the editor; the arrow button removes the last vertex. With the grid focused, arrow keys move a cursor, and Enter or Space adds it. Coordinates provides a keyboard alternative to dragging. Drag cancellation restores the original polygon. The grid keeps its projection during direct editing; choosing an example or editing coordinates fits the view.

Pick’s theorem requires a simple lattice polygon without holes. Clockwise/counterclockwise input and forward collinear edges are supported. Crossings, touches, repeated vertices and backtracking edges are rejected. Invalid input hides results and disables PNG. The editor allows 64 vertices, coordinates −1000…1000 and at most 20,000 grid points including padding; very dense points can merge visually.

PNG exports the current grid without the editing cursor, plus the numeric equality. Embedded metadata contains vertices and independent counts. Exports are discarded if input changes before completion. All processing stays in your browser.