Reputation: 14261
I have an user drawn UIBezierPath and I want to know if it intersects itself. Can anyone point me in a good direction for detecting this?
Thanks!
Upvotes: 1
Views: 1211
Reputation: 2018
How do you build your path? Is it just an accumulation of straight line segments? If so you could keep a list of those (parallel to your UIBezierPath, that you use for rendering), and then perform line intersection tests. It'll be O(N^2), though, in the naive implementation.
Upvotes: 1