Skip to content

Instantly share code, notes, and snippets.

@C4Tutorials
Last active December 16, 2015 06:19
Show Gist options
  • Save C4Tutorials/5390758 to your computer and use it in GitHub Desktop.
Save C4Tutorials/5390758 to your computer and use it in GitHub Desktop.
Polygon Spiral
//
// C4WorkSpace.m
// Complex Shapes Tutorial
//
// Created by Travis Kirton.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
CGPoint polyPts[64];
for(int i = 0; i < 64; i++) {
polyPts[i] = CGPointMake(4*i*[C4Math sin:TWO_PI/16*i], 4*i*[C4Math cos:TWO_PI/16*i]);
polyPts[i].x += self.canvas.center.x;
polyPts[i].y += self.canvas.center.y;
}
C4Shape *spiral = [C4Shape polygon:polyPts pointCount:64];
[self.canvas addShape:spiral];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment