Created
June 4, 2014 01:27
-
-
Save ShonFrazier/29c3a9421a16b592fa78 to your computer and use it in GitHub Desktop.
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
// Playground - noun: a place where people can play | |
import Cocoa | |
let polyPath = NSBezierPath() | |
var sides = 8 | |
var π = 0.0 | |
var π = 3.14159 | |
var π2 = 2*π | |
var π₯ = π2 / Double(sides) | |
var d = 50.0 | |
polyPath.moveToPoint(NSPoint(x: d, y: 0.0)) | |
for var π© = 0; π© <= sides; π©++ { | |
π = Double(π©) * π₯ | |
var pt = NSPoint(x: cos(π) * d, y: sin(π) * d) | |
polyPath.lineToPoint(pt) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment