The winding number counts how many times a closed curve travels around a point — a signed integer, positive for counter-clockwise loops. For point-in-polygon it is the robust cousin of ray casting: it is 1 inside a simple polygon and 0 outside, and unlike the even-odd rule it stays correct for self-overlapping paths and non-zero fill rules (the ones every vector renderer offers). You compute it by summing signed edge crossings — up-and-left adds one, down-and-right subtracts one. A topological quantity from local arithmetic, edge by edge.
The demo computes the winding number of a square around two points — 1 inside, 0 outside: live demo
“Inside is just odd crossings.” — the winding number is signed, so it fills self-overlapping paths correctly where parity fails. cited
A topological wrap-count assembled from signed local crossings — how many times the boundary circles the point. recognizer
On the canonical compiler, the square winds once around (2,2) (inside) and zero times around (6,2) (outside):