ios - UIBezierPath path's intersection -


i trying determine if uibezierpath draw intersects one.

if path.containspoint(touchpoint){        println("captured \(touchpoint) ")               } 

however, containspoint(cgpoint:) doesn't work me, because returns true if

the point considered within path’s enclosed area or false if not.

just provide graphical example, returns true (i'm drawing dashed path):

so question is: how can check if touchpoint belongs uibezierpath, in sense hits specific point of path?

thanks in advance

if touch point want determine lies within stroke of bezier path or not can use cgpathcreatecopybystrokingpath create closed path version of original open path trying hit test. newly created closed path can use containspoint method check.

the technique described in blog post in detail. http://oleb.net/blog/2012/02/cgpath-hit-testing/

you may need expand width of copied stroke allow fat fingers. in blog post, example, makes hit test path @ least 35 points.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -