# How do you compute the winding number of a closed poly curve?

Pretty much the title, given a closed curve in 2D, defined by a set of points, and a point. What's the algorithm to calculate the winding number of that curve, point pair?

Unless I'm mistaken, one way is to fire, say, a horizontal 'ray' out from your point towards, say, $$+\infty$$. Each time you cross an edge, $$(V_n V_{n+1})$$ that is going up (i.e.$$V_n[y] ) , increment a counter, and decrement if the edge is going down.