Skip to content

Instantly share code, notes, and snippets.

@Changzw
Created October 8, 2018 07:11
Show Gist options
  • Save Changzw/757380b5e909d2b1cddbb8890c0b3f5e to your computer and use it in GitHub Desktop.
Save Changzw/757380b5e909d2b1cddbb8890c0b3f5e to your computer and use it in GitHub Desktop.
judge CGPath Intersection
BOOL CGPathIntersectsCircle(CGPathRef path, CGPoint center, CGFloat radius){
CGPathRef extendPath;
extendPath = CGPathCreateCopyByStrokingPath(path, NULL, radius,
kCGLineCapRound,
kCGLineJoinRound, 0.0);
if (CGPathContainsPoint(extendPath, NULL, center, NO)){
CGPathRelease(extendPath);
return YES;
}
CGPathRelease(extendPath);
return NO;
}
@Changzw
Copy link
Author

Changzw commented Oct 8, 2018

It refer from this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment