Original Post
Is it possible to determine if a polygon (represented as a sequential list of n vertices) intersects itself in faster than O(n^2) time? If so, how? Anybody here with strong computational-geometry-fu got some nice winding number or sweepline tricks? :-) I mean, I could always do the usual, - Put all the edges into buckets using a spatial hash: O(n) - Check each edge against other edges in the same bucket: Expected O(n^2/m) if I have m buckets and edges are uniformly distributed between buckets (not exactly true, but O(n^2/m) is still basically correct). and maybe I should be happy with this -- by choosing small enough buckets I can trade memory for making the quadratic portion of the cost arbitrarily small. But I feel like this problem has so much structure that there have got to be smarter approaches. Any ideas?