Reputation: 42
I have a problem. I created sinusoide using code: sinusoide and increased the thickness with path.lineWidth. I also added a dot to the screen (CAShapeLayer). I need to check if my dot is in the sinusoidal. I checked the available function UIBezierPath.contain. Unfortunately, it does not considering the lineWidth. I also checked by color if the pixel on the screen contains color but unfortunately it is very slow and takes 100% CPU. Whether there is any other quick way to find out if the dot is in the UIBezierPath?
Upvotes: 0
Views: 34
Reputation: 385510
Use copy(strokingWithWidth:lineCap:lineJoin:miterLimit:transform:)
to create a stroked copy of the path. Then use contains
on the copy to test the center of the dot.
Upvotes: 1