Created
June 3, 2011 02:34
-
-
Save madebyjeffrey/1005761 to your computer and use it in GitHub Desktop.
pie Slice
This file contains hidden or 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
+ pieSliceWithCentre: (CGPoint) c innerRadius: (double) ir outerRadius: (double) or | |
startAngle: (double) theta1 endAngle: (double) theta2 { | |
UIBezierPath *path = [UIBezierPath bezierPath]; | |
if (path) { | |
[path moveToPoint: CGPointMake(cos(theta1)*ir, sin(theta1)*or)]; | |
[path addLineToPoint: CGPointMake(cos(theta1)*or, sin(theta1)*or)]; | |
[path addArcWithCenter: CGPointZero radius: or startAngle: theta1 endAngle: theta2 clockwise: NO]; | |
[path addLineToPoint: CGPointMake(cos(theta2)*ir, sin(theta2)*ir)]; | |
[path addArcWithCenter: CGPointZero radius: ir startAngle: theta2 endAngle:theta1 clockwise: NO]; | |
[path closePath]; | |
[path applyTransform: CGAffineTransformMakeTranslation(c.x, c.y)]; | |
} | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment