 
     let count = points.count
     assert(count >= 3, "closedCGPath requires at least 3 points")
+
     path.move(to: points[0])
     for i in 1..<count {
         path.addLine(to: points[i])

extension CGRect {
    
    /// Get the center point of a CGRect.
    var center: CGPoint {
        return CGPoint(x: midX, y: midY)
    }
}


/// Calculate cosine for a CGFloat angle.
func cos(_ radians: CGFloat) -> CGFloat {
    return CGFloat(cos(radians.native))
}

/// Calculate sine for a CGFloat angle.
func sin(_ radians: CGFloat) -> CGFloat {
    return CGFloat(sin(radians.native))
}

extension CGVector {
