Skip to content

Instantly share code, notes, and snippets.

@C4Examples
Created July 24, 2012 19:02
Show Gist options
  • Save C4Examples/3171914 to your computer and use it in GitHub Desktop.
Save C4Examples/3171914 to your computer and use it in GitHub Desktop.
Arcs & Wedges
//
// C4WorkSpace.m
// Examples
//
// Created by Travis Kirton on 12-07-19.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
CGPoint arcCenter, wedgeCenter;
arcCenter = self.canvas.center;
arcCenter.y = self.canvas.height * 1/3;
wedgeCenter = self.canvas.center;
wedgeCenter.y = self.canvas.height * 2/3;
C4Shape *clockwiseArc, *counterClockwiseArc, *clockwiseWedge, *counterClockwiseWedge;
//create the counter-clockwise arc
counterClockwiseArc = [C4Shape arcWithCenter:arcCenter radius:100 startAngle:0 endAngle:PI*2/3 clockwise:NO];
[counterClockwiseArc closeShape];
//create the clockwise arc, first shifting the center of the arc
arcCenter.x += 8;
arcCenter.y += 14;
clockwiseArc = [C4Shape arcWithCenter:arcCenter radius:100 startAngle:0 endAngle:PI*2/3 clockwise:YES];
[clockwiseArc closeShape];
//create the counter-clockwise wedge
counterClockwiseWedge = [C4Shape wedgeWithCenter:wedgeCenter radius:100 startAngle:0 endAngle:PI*2/3 clockwise:NO];
//create the clockwise wedge, first shifting the center of the wedge
wedgeCenter.x += 9;
wedgeCenter.y += 14;
clockwiseWedge = [C4Shape wedgeWithCenter:wedgeCenter radius:100 startAngle:0 endAngle:PI*2/3 clockwise:YES];
//add the shapes to the canvas
[self.canvas addShape:clockwiseArc];
[self.canvas addShape:counterClockwiseArc];
[self.canvas addShape:clockwiseWedge];
[self.canvas addShape:counterClockwiseWedge];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment