     }
 }
 
-public func renderFlatShaded(model: Mesh, image: Image) {
-    (0..<model.faces.count).forEach { (index) in
-        let face = model.faces[index]
-
-    }
-}
-
 /**
  Projects a 3d coordinate from world space into 2d image space orthographically.
- 
+
  Coordinates will be scaled both horiztonally and vertically to fit the image
  dimensions.
 
  - parameter coordinate: The world-space 3d coordinate to project.
  - parameter image: The image to project into.
+
+ - returns: The projected point.
  */
-
 func screenCoordinateForWorldCoordinate(coordinate: Vector3<Float>, image: Image) -> Point2d<Int> {
     let halfWidth = Float(image.width / 2)
     let halfHeight = Float(image.height / 2)

    }
}

func triangleContainsPoint(triangle: Triangle<Int>, point: Point2d<Int>) -> Bool {
    let v1 = Vector3(Float(triangle.p3.x - triangle.p1.x), Float(triangle.p2.x - triangle.p1.x), Float(triangle.p1.x - point.x))
    let v2 = Vector3(Float(triangle.p3.y - triangle.p1.y), Float(triangle.p2.y - triangle.p1.y), Float(triangle.p1.y - point.y))


    return Point2d(Int(x), Int(y))
}

/**
 Projects a face consisting of three 3d coordinates from world space into 2d
 image space orthographically.

 Coordinates will be scaled both horiztonally and vertically to fit the image
 dimensions.

 - parameter face: The world-space 3d face to project (must be triangular).
 - parameter mode: The model the face belongs to. This is used to look up vertices.
 - parameter image: The image to project into.

 - returns: The projected triangle.
 */
func projectModelFaceIntoScreenSpaceTriangle(face: Vector3<Int>, model: Mesh, image: Image) -> Triangle<Int> {
    let vertex1 = model.vertices[face.x]
    let vertex2 = model.vertices[face.y]
    let vertex3 = model.vertices[face.z]

    let point1 = screenCoordinateForWorldCoordinate(vertex1, image: image)
    let point2 = screenCoordinateForWorldCoordinate(vertex2, image: image)
    let point3 = screenCoordinateForWorldCoordinate(vertex3, image: image)
    return Triangle(point1, point2, point3)
}
