         }
         result[i] *= sum
     }
-    return result
-}
-
-@warn_unused_result
-public func BezierPolynomial(p: Double ... ) -> [Double] {
+    return Polynomial(result)
+}
+
+@warn_unused_result
+public func BezierPolynomial(p: Double ... ) -> Polynomial {
     
     return BezierPolynomial(p)
 }

    return result
}

private func BezierPolynomial(p: [Double]) -> [Double] {
    
    var result = PermutationList(UInt(p.count - 1)).map(Double.init) as Array
    for i in result.indices {

    
    let list = [b0, b1, b2, b3, b4] + b5
    
    var x = BezierPolynomial(list.map { $0.x })
    var y = BezierPolynomial(list.map { $0.y })
    
    x[0] -= point.x
    y[0] -= point.y
