Created
October 8, 2018 07:11
-
-
Save Changzw/757380b5e909d2b1cddbb8890c0b3f5e to your computer and use it in GitHub Desktop.
judge CGPath Intersection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It refer from this