Professional Documents
Culture Documents
March 9th
March 9th
Project Description: This assignment I incorporated a creative usage of images in a program. I created a program
that makes an abstract self-portrait of a hand. To construct this self-portrait, I used simple drawing primitives,
such as lines and triangles.
//
// ViewController.swift
//
import Cocoa
import Tin
strokeDisable()
let width = 20.0
for _ in 1...10000 {
let pixelX = Int(random(max: tin.width))
let pixelY = Int(random(max: tin.height))
if pixelX % 3 == 0 {
rect(x: Double(pixelX), y: Double(pixelY), width: w, height: w)
}
else {
triangle(x1: Double (pixelX), y1: Double(pixelY), x2: Double (pixelX) + w, y2: Double (pixelY) +
w, x3: Double (pixelX) + (2 * w) , y3: Double (pixelY))
}
view?.stopUpdates()