     let center = CGPoint(x: bounds.width / 2.0, y: bounds.height / 2.0)
     var angle: CGFloat = -CGFloat(M_PI / 2.0)
     let angleIncrement = CGFloat(M_PI * 2.0 / Double(sides))
-    let radius = bounds.width / 2.0
+    let length = min(bounds.width, bounds.height)
+    let radius = length / 2.0
     
     path.move(to: pointFrom(angle, radius: radius, offset: center))
     for _ in 1...sides - 1 {

  
  private func maskWaveFromString(_ mask: String) {
    let params = retrieveMaskParameters(mask, maskName: MaskType.wave.rawValue).components(separatedBy: ",")
    if let unwrappedWidth = Float(params[1]), unwrappedOffset = Float(params[2]) where params.count == 3 {
      let up = params[0] == "up"
      maskWave(up, waveWidth: CGFloat(unwrappedWidth), waveOffset: CGFloat(unwrappedOffset))
    } else {
      maskWave()
    }
  }
  

  // MARK: - Circle
  
  private func maskCircle() {
    let diameter = ceil(min(bounds.width, bounds.height))
    let origin = CGPoint(x: (bounds.width - diameter) / 2.0, y: (bounds.height - diameter) / 2.0)
    let size = CGSize(width: diameter, height: diameter)
    let circlePath = UIBezierPath(ovalIn: CGRect(origin: origin, size: size))
    drawPath(circlePath)
  }
  
  // MARK: - Polygon
