Skip to content

Instantly share code, notes, and snippets.

@ShonFrazier
Created June 4, 2014 01:27
Show Gist options
  • Save ShonFrazier/29c3a9421a16b592fa78 to your computer and use it in GitHub Desktop.
Save ShonFrazier/29c3a9421a16b592fa78 to your computer and use it in GitHub Desktop.
// 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